summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-adp5520.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-04 09:01:50 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 05:21:02 -0500
commit5060e0e8934ca6685ea8bf185cbe0fa2118a946e (patch)
tree7d51a27af094968de6bef132dc35565f686fd146 /drivers/gpio/gpio-adp5520.c
parent1e69c4fe2a67a63e6b392338dd01627ee26f9ca3 (diff)
gpio: adp5520: use gpiochip data pointer
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(). Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-adp5520.c')
-rw-r--r--drivers/gpio/gpio-adp5520.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index caff711ca5a9..4fa7ff1fec9a 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -27,7 +27,7 @@ static int adp5520_gpio_get_value(struct gpio_chip *chip, unsigned off)
27 struct adp5520_gpio *dev; 27 struct adp5520_gpio *dev;
28 uint8_t reg_val; 28 uint8_t reg_val;
29 29
30 dev = container_of(chip, struct adp5520_gpio, gpio_chip); 30 dev = gpiochip_get_data(chip);
31 31
32 /* 32 /*
33 * There are dedicated registers for GPIO IN/OUT. 33 * There are dedicated registers for GPIO IN/OUT.
@@ -46,7 +46,7 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip,
46 unsigned off, int val) 46 unsigned off, int val)
47{ 47{
48 struct adp5520_gpio *dev; 48 struct adp5520_gpio *dev;
49 dev = container_of(chip, struct adp5520_gpio, gpio_chip); 49 dev = gpiochip_get_data(chip);
50 50
51 if (val) 51 if (val)
52 adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]); 52 adp5520_set_bits(dev->master, ADP5520_GPIO_OUT, dev->lut[off]);
@@ -57,7 +57,7 @@ static void adp5520_gpio_set_value(struct gpio_chip *chip,
57static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off) 57static int adp5520_gpio_direction_input(struct gpio_chip *chip, unsigned off)
58{ 58{
59 struct adp5520_gpio *dev; 59 struct adp5520_gpio *dev;
60 dev = container_of(chip, struct adp5520_gpio, gpio_chip); 60 dev = gpiochip_get_data(chip);
61 61
62 clear_bit(off, &dev->output); 62 clear_bit(off, &dev->output);
63 63
@@ -70,7 +70,7 @@ static int adp5520_gpio_direction_output(struct gpio_chip *chip,
70{ 70{
71 struct adp5520_gpio *dev; 71 struct adp5520_gpio *dev;
72 int ret = 0; 72 int ret = 0;
73 dev = container_of(chip, struct adp5520_gpio, gpio_chip); 73 dev = gpiochip_get_data(chip);
74 74
75 set_bit(off, &dev->output); 75 set_bit(off, &dev->output);
76 76
@@ -153,7 +153,7 @@ static int adp5520_gpio_probe(struct platform_device *pdev)
153 goto err; 153 goto err;
154 } 154 }
155 155
156 ret = gpiochip_add(&dev->gpio_chip); 156 ret = gpiochip_add_data(&dev->gpio_chip, dev);
157 if (ret) 157 if (ret)
158 goto err; 158 goto err;
159 159