]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pinctrl: bcm2835: use gpiochip data pointer
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Dec 2015 21:01:00 +0000 (22:01 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 5 Jan 2016 13:14:48 +0000 (14:14 +0100)
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: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/bcm/pinctrl-bcm2835.c

index 595f87028b19207b8c08bc1769b53b72b0a3ba59..7c35249058f61837de5d7b9db7287e3c9ae9c000 100644 (file)
@@ -23,7 +23,7 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/irq.h>
@@ -337,14 +337,14 @@ static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 
 static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-       struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+       struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
 
        return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
 }
 
 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-       struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+       struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
 
        bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
 }
@@ -358,7 +358,7 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
 
 static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 {
-       struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+       struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
 
        return irq_linear_revmap(pc->irq_domain, offset);
 }
@@ -1021,7 +1021,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
                }
        }
 
-       err = gpiochip_add(&pc->gpio_chip);
+       err = gpiochip_add_data(&pc->gpio_chip, pc);
        if (err) {
                dev_err(dev, "could not add GPIO chip\n");
                return err;