aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2016-03-30 04:48:03 -0400
committerLee Jones <lee.jones@linaro.org>2016-04-19 02:58:23 -0400
commit8d5f095fc5f7e36f40a80e87317828be249ee454 (patch)
treea866866beadd25945e8b57911138ad3edc0bb7ec /drivers/mfd
parent4363765c851313d460db86f2d41d2eebca0d9c17 (diff)
mfd: htc-egpio: 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(). Acked-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/htc-egpio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c
index c636b5f83cfb..513cfc5c8fb6 100644
--- a/drivers/mfd/htc-egpio.c
+++ b/drivers/mfd/htc-egpio.c
@@ -155,7 +155,7 @@ static int egpio_get(struct gpio_chip *chip, unsigned offset)
155 155
156 pr_debug("egpio_get_value(%d)\n", chip->base + offset); 156 pr_debug("egpio_get_value(%d)\n", chip->base + offset);
157 157
158 egpio = container_of(chip, struct egpio_chip, chip); 158 egpio = gpiochip_get_data(chip);
159 ei = dev_get_drvdata(egpio->dev); 159 ei = dev_get_drvdata(egpio->dev);
160 bit = egpio_bit(ei, offset); 160 bit = egpio_bit(ei, offset);
161 reg = egpio->reg_start + egpio_pos(ei, offset); 161 reg = egpio->reg_start + egpio_pos(ei, offset);
@@ -170,7 +170,7 @@ static int egpio_direction_input(struct gpio_chip *chip, unsigned offset)
170{ 170{
171 struct egpio_chip *egpio; 171 struct egpio_chip *egpio;
172 172
173 egpio = container_of(chip, struct egpio_chip, chip); 173 egpio = gpiochip_get_data(chip);
174 return test_bit(offset, &egpio->is_out) ? -EINVAL : 0; 174 return test_bit(offset, &egpio->is_out) ? -EINVAL : 0;
175} 175}
176 176
@@ -192,7 +192,7 @@ static void egpio_set(struct gpio_chip *chip, unsigned offset, int value)
192 pr_debug("egpio_set(%s, %d(%d), %d)\n", 192 pr_debug("egpio_set(%s, %d(%d), %d)\n",
193 chip->label, offset, offset+chip->base, value); 193 chip->label, offset, offset+chip->base, value);
194 194
195 egpio = container_of(chip, struct egpio_chip, chip); 195 egpio = gpiochip_get_data(chip);
196 ei = dev_get_drvdata(egpio->dev); 196 ei = dev_get_drvdata(egpio->dev);
197 bit = egpio_bit(ei, offset); 197 bit = egpio_bit(ei, offset);
198 pos = egpio_pos(ei, offset); 198 pos = egpio_pos(ei, offset);
@@ -216,7 +216,7 @@ static int egpio_direction_output(struct gpio_chip *chip,
216{ 216{
217 struct egpio_chip *egpio; 217 struct egpio_chip *egpio;
218 218
219 egpio = container_of(chip, struct egpio_chip, chip); 219 egpio = gpiochip_get_data(chip);
220 if (test_bit(offset, &egpio->is_out)) { 220 if (test_bit(offset, &egpio->is_out)) {
221 egpio_set(chip, offset, value); 221 egpio_set(chip, offset, value);
222 return 0; 222 return 0;
@@ -330,7 +330,7 @@ static int __init egpio_probe(struct platform_device *pdev)
330 chip->base = pdata->chip[i].gpio_base; 330 chip->base = pdata->chip[i].gpio_base;
331 chip->ngpio = pdata->chip[i].num_gpios; 331 chip->ngpio = pdata->chip[i].num_gpios;
332 332
333 gpiochip_add(chip); 333 gpiochip_add_data(chip, &ei->chip[i]);
334 } 334 }
335 335
336 /* Set initial pin values */ 336 /* Set initial pin values */