]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
input: ad7879: use gpiochip data pointer
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Dec 2015 15:35:27 +0000 (16:35 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 30 Mar 2016 08:54:42 +0000 (10:54 +0200)
This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/input/touchscreen/ad7879.c

index 69d299d5dd00b1a0dda797283cad911cce2ee4ca..e4bf1103e6f8bffc54c9df2f432218134dd63dda 100644 (file)
@@ -379,7 +379,7 @@ static const struct attribute_group ad7879_attr_group = {
 static int ad7879_gpio_direction_input(struct gpio_chip *chip,
                                        unsigned gpio)
 {
-       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       struct ad7879 *ts = gpiochip_get_data(chip);
        int err;
 
        mutex_lock(&ts->mutex);
@@ -393,7 +393,7 @@ static int ad7879_gpio_direction_input(struct gpio_chip *chip,
 static int ad7879_gpio_direction_output(struct gpio_chip *chip,
                                        unsigned gpio, int level)
 {
-       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       struct ad7879 *ts = gpiochip_get_data(chip);
        int err;
 
        mutex_lock(&ts->mutex);
@@ -412,7 +412,7 @@ static int ad7879_gpio_direction_output(struct gpio_chip *chip,
 
 static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
 {
-       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       struct ad7879 *ts = gpiochip_get_data(chip);
        u16 val;
 
        mutex_lock(&ts->mutex);
@@ -425,7 +425,7 @@ static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
 static void ad7879_gpio_set_value(struct gpio_chip *chip,
                                  unsigned gpio, int value)
 {
-       struct ad7879 *ts = container_of(chip, struct ad7879, gc);
+       struct ad7879 *ts = gpiochip_get_data(chip);
 
        mutex_lock(&ts->mutex);
        if (value)
@@ -456,7 +456,7 @@ static int ad7879_gpio_add(struct ad7879 *ts,
                ts->gc.owner = THIS_MODULE;
                ts->gc.parent = ts->dev;
 
-               ret = gpiochip_add(&ts->gc);
+               ret = gpiochip_add_data(&ts->gc, ts);
                if (ret)
                        dev_err(ts->dev, "failed to register gpio %d\n",
                                ts->gc.base);