diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-08 08:28:45 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-02-19 03:51:43 -0500 |
commit | f5abf9ee51910b2cae03c11f1f7be1d6dd2be61e (patch) | |
tree | 8849b869ca0567547ef3751f35777d3094a06df1 | |
parent | 6483d829201f5b14f559c343c150cf27c6c1b24e (diff) |
MIPS: jz4740: 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: linux-mips@linux-mips.org
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | arch/mips/jz4740/gpio.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c index d9907e57e9b9..b765773ab8aa 100644 --- a/arch/mips/jz4740/gpio.c +++ b/arch/mips/jz4740/gpio.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | 19 | ||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/gpio/driver.h> | ||
22 | /* FIXME: needed for gpio_request(), try to remove consumer API from driver */ | ||
21 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
22 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
23 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
@@ -91,9 +93,9 @@ static inline struct jz_gpio_chip *gpio_to_jz_gpio_chip(unsigned int gpio) | |||
91 | return &jz4740_gpio_chips[gpio >> 5]; | 93 | return &jz4740_gpio_chips[gpio >> 5]; |
92 | } | 94 | } |
93 | 95 | ||
94 | static inline struct jz_gpio_chip *gpio_chip_to_jz_gpio_chip(struct gpio_chip *gpio_chip) | 96 | static inline struct jz_gpio_chip *gpio_chip_to_jz_gpio_chip(struct gpio_chip *gc) |
95 | { | 97 | { |
96 | return container_of(gpio_chip, struct jz_gpio_chip, gpio_chip); | 98 | return gpiochip_get_data(gc); |
97 | } | 99 | } |
98 | 100 | ||
99 | static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(struct irq_data *data) | 101 | static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(struct irq_data *data) |
@@ -234,7 +236,7 @@ static int jz_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | |||
234 | 236 | ||
235 | static int jz_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) | 237 | static int jz_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) |
236 | { | 238 | { |
237 | struct jz_gpio_chip *jz_gpio = gpio_chip_to_jz_gpio_chip(chip); | 239 | struct jz_gpio_chip *jz_gpio = gpiochip_get_data(chip); |
238 | 240 | ||
239 | return jz_gpio->irq_base + gpio; | 241 | return jz_gpio->irq_base + gpio; |
240 | } | 242 | } |
@@ -449,7 +451,7 @@ static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id) | |||
449 | irq_setup_generic_chip(gc, IRQ_MSK(chip->gpio_chip.ngpio), | 451 | irq_setup_generic_chip(gc, IRQ_MSK(chip->gpio_chip.ngpio), |
450 | IRQ_GC_INIT_NESTED_LOCK, 0, IRQ_NOPROBE | IRQ_LEVEL); | 452 | IRQ_GC_INIT_NESTED_LOCK, 0, IRQ_NOPROBE | IRQ_LEVEL); |
451 | 453 | ||
452 | gpiochip_add(&chip->gpio_chip); | 454 | gpiochip_add_data(&chip->gpio_chip, chip); |
453 | } | 455 | } |
454 | 456 | ||
455 | static int __init jz4740_gpio_init(void) | 457 | static int __init jz4740_gpio_init(void) |