diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 14:58:56 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 11:21:16 +0100 |
commit | 7020e7c513e91a2e18ab67935e657c4de17e9043 (patch) | |
tree | cd16c86ee15c3cea61984f7597e9fe07343189ae /drivers/gpio | |
parent | 059e3972d00760e7d6dda54789fbbe05acf186a1 (diff) | |
download | blackbird-op-linux-7020e7c513e91a2e18ab67935e657c4de17e9043.tar.gz blackbird-op-linux-7020e7c513e91a2e18ab67935e657c4de17e9043.zip |
gpio: tz1090: 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.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/gpio/gpio-tz1090.c b/drivers/gpio/gpio-tz1090.c index a4a822542ac1..ca958e0f6909 100644 --- a/drivers/gpio/gpio-tz1090.c +++ b/drivers/gpio/gpio-tz1090.c @@ -62,7 +62,6 @@ struct tz1090_gpio_bank { int irq; char label[16]; }; -#define to_bank(c) container_of(c, struct tz1090_gpio_bank, chip) /** * struct tz1090_gpio - Overall GPIO device private data @@ -187,7 +186,7 @@ static inline int tz1090_gpio_read_bit(struct tz1090_gpio_bank *bank, static int tz1090_gpio_direction_input(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset); return 0; @@ -196,7 +195,7 @@ static int tz1090_gpio_direction_input(struct gpio_chip *chip, static int tz1090_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int lstat; __global_lock2(lstat); @@ -212,7 +211,7 @@ static int tz1090_gpio_direction_output(struct gpio_chip *chip, */ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); return !!tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset); } @@ -223,14 +222,14 @@ static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_set(struct gpio_chip *chip, unsigned int offset, int output_value) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value); } static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); int ret; ret = pinctrl_request_gpio(chip->base + offset); @@ -245,7 +244,7 @@ static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset) static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); pinctrl_free_gpio(chip->base + offset); @@ -254,7 +253,7 @@ static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset) static int tz1090_gpio_to_irq(struct gpio_chip *chip, unsigned int offset) { - struct tz1090_gpio_bank *bank = to_bank(chip); + struct tz1090_gpio_bank *bank = gpiochip_get_data(chip); if (!bank->domain) return -EINVAL; @@ -440,7 +439,7 @@ static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info) bank->chip.ngpio = 30; /* Add the GPIO bank */ - gpiochip_add(&bank->chip); + gpiochip_add_data(&bank->chip, bank); /* Get the GPIO bank IRQ if provided */ bank->irq = irq_of_parse_and_map(np, 0); |