aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-08 16:12:11 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 08:15:07 -0500
commit80036f88db18b98bc20f7321dbd5f9947576a2b2 (patch)
tree088383c4e20b60fea9563df83387cffe57a747af
parent11aa679a6a0b20fe105a7a955a82153e255bae74 (diff)
pinctrl: at91-pio4: 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(). Cc: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-at91-pio4.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index f1daf8580167..27540f5a1067 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -15,6 +15,8 @@
15 */ 15 */
16 16
17#include <linux/clk.h> 17#include <linux/clk.h>
18#include <linux/gpio/driver.h>
19/* FIXME: needed for gpio_to_irq(), get rid of this */
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19#include <linux/interrupt.h> 21#include <linux/interrupt.h>
20#include <linux/io.h> 22#include <linux/io.h>
@@ -290,7 +292,7 @@ static void atmel_gpio_irq_handler(struct irq_desc *desc)
290 292
291static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 293static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
292{ 294{
293 struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); 295 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
294 struct atmel_pin *pin = atmel_pioctrl->pins[offset]; 296 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
295 unsigned reg; 297 unsigned reg;
296 298
@@ -305,7 +307,7 @@ static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
305 307
306static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset) 308static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
307{ 309{
308 struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); 310 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
309 struct atmel_pin *pin = atmel_pioctrl->pins[offset]; 311 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
310 unsigned reg; 312 unsigned reg;
311 313
@@ -317,7 +319,7 @@ static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
317static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, 319static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
318 int value) 320 int value)
319{ 321{
320 struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); 322 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
321 struct atmel_pin *pin = atmel_pioctrl->pins[offset]; 323 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
322 unsigned reg; 324 unsigned reg;
323 325
@@ -336,7 +338,7 @@ static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
336 338
337static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val) 339static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
338{ 340{
339 struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); 341 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
340 struct atmel_pin *pin = atmel_pioctrl->pins[offset]; 342 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
341 343
342 atmel_gpio_write(atmel_pioctrl, pin->bank, 344 atmel_gpio_write(atmel_pioctrl, pin->bank,
@@ -346,7 +348,7 @@ static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
346 348
347static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 349static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
348{ 350{
349 struct atmel_pioctrl *atmel_pioctrl = dev_get_drvdata(chip->parent); 351 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
350 352
351 return irq_find_mapping(atmel_pioctrl->irq_domain, offset); 353 return irq_find_mapping(atmel_pioctrl->irq_domain, offset);
352} 354}
@@ -1037,7 +1039,7 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
1037 goto pinctrl_register_error; 1039 goto pinctrl_register_error;
1038 } 1040 }
1039 1041
1040 ret = gpiochip_add(atmel_pioctrl->gpio_chip); 1042 ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl);
1041 if (ret) { 1043 if (ret) {
1042 dev_err(dev, "failed to add gpiochip\n"); 1044 dev_err(dev, "failed to add gpiochip\n");
1043 goto gpiochip_add_error; 1045 goto gpiochip_add_error;