aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-08 03:24:32 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 08:14:53 -0500
commitf5bc3568db62c483049ce688baa06ff68dfb0fbd (patch)
treec689dff048d4fa30ce9f5c779a8372ff0c402b72
parent04d367231162560a51e875836a1f2ebf41780adf (diff)
pinctrl: as3722: 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: Andrew Bresticker <abrestic@chromium.org> Cc: Mallikarjun Kasoju <mkasoju@nvidia.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-as3722.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c
index 89479bea6262..e844fdc6d3a8 100644
--- a/drivers/pinctrl/pinctrl-as3722.c
+++ b/drivers/pinctrl/pinctrl-as3722.c
@@ -436,14 +436,9 @@ static struct pinctrl_desc as3722_pinctrl_desc = {
436 .owner = THIS_MODULE, 436 .owner = THIS_MODULE,
437}; 437};
438 438
439static inline struct as3722_pctrl_info *to_as_pci(struct gpio_chip *chip)
440{
441 return container_of(chip, struct as3722_pctrl_info, gpio_chip);
442}
443
444static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset) 439static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
445{ 440{
446 struct as3722_pctrl_info *as_pci = to_as_pci(chip); 441 struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
447 struct as3722 *as3722 = as_pci->as3722; 442 struct as3722 *as3722 = as_pci->as3722;
448 int ret; 443 int ret;
449 u32 reg; 444 u32 reg;
@@ -491,7 +486,7 @@ static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset)
491static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset, 486static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset,
492 int value) 487 int value)
493{ 488{
494 struct as3722_pctrl_info *as_pci = to_as_pci(chip); 489 struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
495 struct as3722 *as3722 = as_pci->as3722; 490 struct as3722 *as3722 = as_pci->as3722;
496 int en_invert; 491 int en_invert;
497 u32 val; 492 u32 val;
@@ -531,7 +526,7 @@ static int as3722_gpio_direction_output(struct gpio_chip *chip,
531 526
532static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 527static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
533{ 528{
534 struct as3722_pctrl_info *as_pci = to_as_pci(chip); 529 struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip);
535 530
536 return as3722_irq_get_virq(as_pci->as3722, offset); 531 return as3722_irq_get_virq(as_pci->as3722, offset);
537} 532}
@@ -584,7 +579,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
584 as_pci->gpio_chip = as3722_gpio_chip; 579 as_pci->gpio_chip = as3722_gpio_chip;
585 as_pci->gpio_chip.parent = &pdev->dev; 580 as_pci->gpio_chip.parent = &pdev->dev;
586 as_pci->gpio_chip.of_node = pdev->dev.parent->of_node; 581 as_pci->gpio_chip.of_node = pdev->dev.parent->of_node;
587 ret = gpiochip_add(&as_pci->gpio_chip); 582 ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci);
588 if (ret < 0) { 583 if (ret < 0) {
589 dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret); 584 dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret);
590 goto fail_chip_add; 585 goto fail_chip_add;