diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 14:57:25 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 11:21:16 +0100 |
commit | 059e3972d00760e7d6dda54789fbbe05acf186a1 (patch) | |
tree | 844ae582d3531e0e992b0ba0fa25c9624e59aea3 /drivers/gpio | |
parent | gpio: twl4030: use gpiochip data pointer (diff) | |
download | linux-059e3972d00760e7d6dda54789fbbe05acf186a1.tar.xz linux-059e3972d00760e7d6dda54789fbbe05acf186a1.zip |
gpio: tz1090-pdc: 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: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-tz1090-pdc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-tz1090-pdc.c b/drivers/gpio/gpio-tz1090-pdc.c index b08b22b1b111..5b7781741ee9 100644 --- a/drivers/gpio/gpio-tz1090-pdc.c +++ b/drivers/gpio/gpio-tz1090-pdc.c @@ -49,7 +49,6 @@ struct tz1090_pdc_gpio { void __iomem *reg; int irq[GPIO_PDC_NIRQ]; }; -#define to_pdc(c) container_of(c, struct tz1090_pdc_gpio, chip) /* Register accesses into the PDC MMIO area */ @@ -70,7 +69,7 @@ static inline unsigned int pdc_read(struct tz1090_pdc_gpio *priv, static int tz1090_pdc_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -87,7 +86,7 @@ static int tz1090_pdc_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -112,14 +111,14 @@ static int tz1090_pdc_gpio_direction_output(struct gpio_chip *chip, static int tz1090_pdc_gpio_get(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); return !!(pdc_read(priv, REG_SOC_GPIO_STATUS) & BIT(offset)); } static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); u32 value; int lstat; @@ -139,7 +138,7 @@ static void tz1090_pdc_gpio_set(struct gpio_chip *chip, unsigned int offset, static int tz1090_pdc_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_pdc_gpio *priv = to_pdc(chip); + struct tz1090_pdc_gpio *priv = gpiochip_get_data(chip); unsigned int syswake = offset - GPIO_PDC_IRQ_FIRST; int irq; @@ -207,7 +206,7 @@ static int tz1090_pdc_gpio_probe(struct platform_device *pdev) priv->irq[i] = irq_of_parse_and_map(np, i); /* Add the GPIO bank */ - gpiochip_add(&priv->chip); + gpiochip_add_data(&priv->chip, priv); return 0; } |