summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 11:42:22 +0100
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 11:21:12 +0100
commit81d0c31d11846f282f08ff81219ff6b7230a78b1 (patch)
tree95a553e81bc9efe3ca4f6e95d36b8a822ddc1326 /drivers
parentd81b37fcad764c7babd7dd858aeb1b9afd2df5cc (diff)
gpio: pxa: 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: Daniel Mack <zonque@gmail.com> Acked-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-pxa.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index 415852d3ca8a..b2b7b78664b8 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -155,14 +155,15 @@ static struct pxa_gpio_id pxa1928_id = {
static inline struct pxa_gpio_chip *chip_to_pxachip(struct gpio_chip *c)
{
- struct pxa_gpio_chip *pxa_chip =
- container_of(c, struct pxa_gpio_chip, chip);
+ struct pxa_gpio_chip *pxa_chip = gpiochip_get_data(c);
return pxa_chip;
}
+
static inline void __iomem *gpio_bank_base(struct gpio_chip *c, int gpio)
{
- struct pxa_gpio_bank *bank = chip_to_pxachip(c)->banks + (gpio / 32);
+ struct pxa_gpio_chip *p = gpiochip_get_data(c);
+ struct pxa_gpio_bank *bank = p->banks + (gpio / 32);
return bank->regbase;
}
@@ -370,7 +371,7 @@ static int pxa_init_gpio_chip(struct pxa_gpio_chip *pchip, int ngpio,
bank->regbase = regbase + BANK_OFF(i);
}
- return gpiochip_add(&pchip->chip);
+ return gpiochip_add_data(&pchip->chip, pchip);
}
/* Update only those GRERx and GFERx edge detection register bits if those