diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 16:29:48 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 13:21:13 +0300 |
commit | 0b2c529a3b4d78d700c616e146411594a60cab18 (patch) | |
tree | 84d43a1695d26c91e160f5438d880657246d3f21 /drivers/gpio/gpio-sta2x11.c | |
parent | c0ad184adb74d30b9010ecdec955d63481f79101 (diff) | |
download | linux-0b2c529a3b4d78d700c616e146411594a60cab18.tar.xz |
gpio: sta2x11: 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: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-sta2x11.c')
-rw-r--r-- | drivers/gpio/gpio-sta2x11.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index af0be81ad2b6..83af1cb36333 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c @@ -74,7 +74,7 @@ static inline u32 __bit(int nr) static void gsta_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -86,7 +86,7 @@ static void gsta_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) static int gsta_gpio_get(struct gpio_chip *gpio, unsigned nr) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -96,7 +96,7 @@ static int gsta_gpio_get(struct gpio_chip *gpio, unsigned nr) static int gsta_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, int val) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -111,7 +111,7 @@ static int gsta_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, static int gsta_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); struct gsta_regs __iomem *regs = __regs(chip, nr); u32 bit = __bit(nr); @@ -121,7 +121,7 @@ static int gsta_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) static int gsta_gpio_to_irq(struct gpio_chip *gpio, unsigned offset) { - struct gsta_gpio *chip = container_of(gpio, struct gsta_gpio, gpio); + struct gsta_gpio *chip = gpiochip_get_data(gpio); return chip->irq_base + offset; } @@ -409,7 +409,7 @@ static int gsta_probe(struct platform_device *dev) goto err_free_descs; } - err = gpiochip_add(&chip->gpio); + err = gpiochip_add_data(&chip->gpio, chip); if (err < 0) { dev_err(&dev->dev, "sta2x11 gpio: Can't register (%i)\n", -err); |