]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iio: remove gpio interrupt probing from drivers that use a single interrupt
authorOctavian Purdila <octavian.purdila@intel.com>
Wed, 23 Sep 2015 09:02:01 +0000 (12:02 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sat, 3 Oct 2015 11:05:51 +0000 (12:05 +0100)
Commit 845c877009cf014b ("i2c / ACPI: Assign IRQ for devices that have
GpioInt automatically") automatically assigns the first ACPI GPIO
interrupt in client->irq, so we can remove the probing code from
drivers that use only one interrupt.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/accel/bmc150-accel.c
drivers/iio/accel/kxcjk-1013.c
drivers/iio/accel/mma9553.c
drivers/iio/accel/stk8312.c
drivers/iio/accel/stk8ba50.c
drivers/iio/imu/kmx61.c
drivers/iio/light/stk3310.c
drivers/iio/magnetometer/bmc150_magn.c
drivers/iio/proximity/sx9500.c

index 0104cdef8709b0dd05be6a337f2396a80629816a..6d19d46b3474e0e076fe3e43acd69bb005ea82ef 100644 (file)
@@ -38,7 +38,6 @@
 
 #define BMC150_ACCEL_DRV_NAME                  "bmc150_accel"
 #define BMC150_ACCEL_IRQ_NAME                  "bmc150_accel_event"
-#define BMC150_ACCEL_GPIO_NAME                 "bmc150_accel_int"
 
 #define BMC150_ACCEL_REG_CHIP_ID               0x00
 
@@ -1360,32 +1359,6 @@ static irqreturn_t bmc150_accel_irq_handler(int irq, void *private)
        return IRQ_NONE;
 }
 
-static int bmc150_accel_gpio_probe(struct i2c_client *client,
-                                  struct bmc150_accel_data *data)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, BMC150_ACCEL_GPIO_NAME, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "Failed: gpio get index\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static const struct {
        int intr;
        const char *name;
@@ -1659,9 +1632,6 @@ static int bmc150_accel_probe(struct i2c_client *client,
                return ret;
        }
 
-       if (client->irq < 0)
-               client->irq = bmc150_accel_gpio_probe(client, data);
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(
                                                &client->dev, client->irq,
index 3292bc0c1d0ef9ea7595c1a4e02effa2dc5c3248..18c1b06684c1b4cb79d2fcb3812d16646fe62e98 100644 (file)
@@ -1162,35 +1162,6 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev,
        return dev_name(dev);
 }
 
-static int kxcjk1013_gpio_probe(struct i2c_client *client,
-                               struct kxcjk1013_data *data)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       if (data->is_smo8500_device)
-               return -ENOTSUPP;
-
-       dev = &client->dev;
-
-       /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, "kxcjk1013_int", 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "acpi gpio get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static int kxcjk1013_probe(struct i2c_client *client,
                           const struct i2c_device_id *id)
 {
@@ -1237,10 +1208,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->info = &kxcjk1013_info;
 
-       if (client->irq < 0)
-               client->irq = kxcjk1013_gpio_probe(client, data);
-
-       if (client->irq > 0) {
+       if (client->irq > 0 && !data->is_smo8500_device) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                kxcjk1013_data_rdy_trig_poll,
                                                kxcjk1013_event_handler,
index 771858cb67a1b57db5472576ecb0656b7d282884..9408ef3add58fbe9cfbcbece029dd8c828c49329 100644 (file)
@@ -26,7 +26,6 @@
 
 #define MMA9553_DRV_NAME                       "mma9553"
 #define MMA9553_IRQ_NAME                       "mma9553_event"
-#define MMA9553_GPIO_NAME                      "mma9553_int"
 
 /* Pedometer configuration registers (R/W) */
 #define MMA9553_REG_CONF_SLEEPMIN              0x00
@@ -1073,31 +1072,6 @@ static irqreturn_t mma9553_event_handler(int irq, void *private)
        return IRQ_HANDLED;
 }
 
-static int mma9553_gpio_probe(struct i2c_client *client)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready GPIO interrupt pin */
-       gpio = devm_gpiod_get_index(dev, MMA9553_GPIO_NAME, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "ACPI GPIO get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static const char *mma9553_match_acpi_device(struct device *dev)
 {
        const struct acpi_device_id *id;
@@ -1146,9 +1120,6 @@ static int mma9553_probe(struct i2c_client *client,
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->info = &mma9553_info;
 
-       if (client->irq < 0)
-               client->irq = mma9553_gpio_probe(client);
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                mma9553_irq_handler,
index a57869400b1ae23f53e90a054646f0ca82e5579c..85fe7f7247c1d57f01cb37c225467e14a6f75a1e 100644 (file)
@@ -50,7 +50,6 @@
 #define STK8312_ALL_CHANNEL_SIZE       3
 
 #define STK8312_DRIVER_NAME            "stk8312"
-#define STK8312_GPIO                   "stk8312_gpio"
 #define STK8312_IRQ_NAME               "stk8312_event"
 
 /*
@@ -504,30 +503,6 @@ static const struct iio_buffer_setup_ops stk8312_buffer_setup_ops = {
        .postdisable = stk8312_buffer_postdisable,
 };
 
-static int stk8312_gpio_probe(struct i2c_client *client)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, STK8312_GPIO, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "acpi gpio get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static int stk8312_probe(struct i2c_client *client,
                         const struct i2c_device_id *id)
 {
@@ -569,9 +544,6 @@ static int stk8312_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       if (client->irq < 0)
-               client->irq = stk8312_gpio_probe(client);
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                stk8312_data_rdy_trig_poll,
index a59f5d87ae3ad6c763d00b22a610db31e5f471cd..5709d9eb8f34ddcecf26f477db6aa09fd424c25f 100644 (file)
@@ -45,7 +45,6 @@
 #define STK8BA50_ALL_CHANNEL_SIZE              6
 
 #define STK8BA50_DRIVER_NAME                   "stk8ba50"
-#define STK8BA50_GPIO                          "stk8ba50_gpio"
 #define STK8BA50_IRQ_NAME                      "stk8ba50_event"
 
 #define STK8BA50_SCALE_AVAIL                   "0.0384 0.0767 0.1534 0.3069"
@@ -388,30 +387,6 @@ static const struct iio_buffer_setup_ops stk8ba50_buffer_setup_ops = {
        .postdisable = stk8ba50_buffer_postdisable,
 };
 
-static int stk8ba50_gpio_probe(struct i2c_client *client)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, STK8BA50_GPIO, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "acpi gpio get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static int stk8ba50_probe(struct i2c_client *client,
                          const struct i2c_device_id *id)
 {
@@ -465,9 +440,6 @@ static int stk8ba50_probe(struct i2c_client *client,
                goto err_power_off;
        }
 
-       if (client->irq < 0)
-               client->irq = stk8ba50_gpio_probe(client);
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                stk8ba50_data_rdy_trig_poll,
index 82cdf5090fa776b1bd0bea6ce570416782d996a9..dbf5e99366358815cd3d840440d6d8cc3adf8b54 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/iio/trigger_consumer.h>
 
 #define KMX61_DRV_NAME "kmx61"
-#define KMX61_GPIO_NAME "kmx61_int"
 #define KMX61_IRQ_NAME "kmx61_event"
 
 #define KMX61_REG_WHO_AM_I     0x00
@@ -1243,30 +1242,6 @@ static const char *kmx61_match_acpi_device(struct device *dev)
        return dev_name(dev);
 }
 
-static int kmx61_gpio_probe(struct i2c_client *client, struct kmx61_data *data)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, KMX61_GPIO_NAME, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "acpi gpio get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-       return ret;
-}
-
 static struct iio_dev *kmx61_indiodev_setup(struct kmx61_data *data,
                                            const struct iio_info *info,
                                            const struct iio_chan_spec *chan,
@@ -1360,9 +1335,6 @@ static int kmx61_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       if (client->irq < 0)
-               client->irq = kmx61_gpio_probe(client, data);
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                kmx61_data_rdy_trig_poll,
index f45b06bcf6ae69577157ecbb472a28673e4cfa42..42d334ba612ea17797702c1cb485a31af8092660 100644 (file)
@@ -47,7 +47,6 @@
 #define STK3310_DRIVER_NAME                    "stk3310"
 #define STK3310_REGMAP_NAME                    "stk3310_regmap"
 #define STK3310_EVENT                          "stk3310_event"
-#define STK3310_GPIO                           "stk3310_gpio"
 
 #define STK3310_SCALE_AVAILABLE                        "6.4 1.6 0.4 0.1"
 
@@ -477,30 +476,6 @@ static int stk3310_init(struct iio_dev *indio_dev)
        return ret;
 }
 
-static int stk3310_gpio_probe(struct i2c_client *client)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* gpio interrupt pin */
-       gpio = devm_gpiod_get_index(dev, STK3310_GPIO, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "acpi gpio get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static bool stk3310_is_volatile_reg(struct device *dev, unsigned int reg)
 {
        switch (reg) {
@@ -624,14 +599,6 @@ static int stk3310_probe(struct i2c_client *client,
        if (ret < 0)
                return ret;
 
-       if (client->irq < 0) {
-               client->irq = stk3310_gpio_probe(client);
-               if (client->irq < 0) {
-                       ret = client->irq;
-                       goto err_standby;
-               }
-       }
-
        if (client->irq > 0) {
                ret = devm_request_threaded_irq(&client->dev, client->irq,
                                                stk3310_irq_handler,
index d8e614ca069fe7e3d55da67464be889a64e8af64..1615b23d7b2a64019c474ac566b5713bf587e29b 100644 (file)
@@ -37,7 +37,6 @@
 
 #define BMC150_MAGN_DRV_NAME                   "bmc150_magn"
 #define BMC150_MAGN_IRQ_NAME                   "bmc150_magn_event"
-#define BMC150_MAGN_GPIO_INT                   "interrupt"
 
 #define BMC150_MAGN_REG_CHIP_ID                        0x40
 #define BMC150_MAGN_CHIP_ID_VAL                        0x32
@@ -833,31 +832,6 @@ static const struct iio_buffer_setup_ops bmc150_magn_buffer_setup_ops = {
        .postdisable = bmc150_magn_buffer_postdisable,
 };
 
-static int bmc150_magn_gpio_probe(struct i2c_client *client)
-{
-       struct device *dev;
-       struct gpio_desc *gpio;
-       int ret;
-
-       if (!client)
-               return -EINVAL;
-
-       dev = &client->dev;
-
-       /* data ready GPIO interrupt pin */
-       gpio = devm_gpiod_get_index(dev, BMC150_MAGN_GPIO_INT, 0, GPIOD_IN);
-       if (IS_ERR(gpio)) {
-               dev_err(dev, "ACPI GPIO get index failed\n");
-               return PTR_ERR(gpio);
-       }
-
-       ret = gpiod_to_irq(gpio);
-
-       dev_dbg(dev, "GPIO resource, no:%d irq:%d\n", desc_to_gpio(gpio), ret);
-
-       return ret;
-}
-
 static const char *bmc150_magn_match_acpi_device(struct device *dev)
 {
        const struct acpi_device_id *id;
@@ -911,9 +885,6 @@ static int bmc150_magn_probe(struct i2c_client *client,
        indio_dev->modes = INDIO_DIRECT_MODE;
        indio_dev->info = &bmc150_magn_info;
 
-       if (client->irq <= 0)
-               client->irq = bmc150_magn_gpio_probe(client);
-
        if (client->irq > 0) {
                data->dready_trig = devm_iio_trigger_alloc(&client->dev,
                                                           "%s-dev%d",
index 3d756bd8c703230bfc93f530d03399f9f5e1413f..66cd09a18786a9123c7eeeb82c0e503ae9dee5e6 100644 (file)
@@ -868,21 +868,12 @@ static void sx9500_gpio_probe(struct i2c_client *client,
                              struct sx9500_data *data)
 {
        struct device *dev;
-       struct gpio_desc *gpio;
 
        if (!client)
                return;
 
        dev = &client->dev;
 
-       if (client->irq <= 0) {
-               gpio = devm_gpiod_get_index(dev, SX9500_GPIO_INT, 0, GPIOD_IN);
-               if (IS_ERR(gpio))
-                       dev_err(dev, "gpio get irq failed\n");
-               else
-                       client->irq = gpiod_to_irq(gpio);
-       }
-
        data->gpiod_rst = devm_gpiod_get_index(dev, SX9500_GPIO_RESET,
                                               0, GPIOD_OUT_HIGH);
        if (IS_ERR(data->gpiod_rst)) {