diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-12-07 05:16:00 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-05 05:21:10 -0500 |
commit | d99f7aec6e8b4ffe10d6df71d17d2c5cbef2ac65 (patch) | |
tree | 95d736efc1d7dfe755a52031992b3df6e8c28c00 /drivers/gpio/gpio-omap.c | |
parent | f5cc554e1cf17482781069b671090d3a35d5413b (diff) |
gpio: omap: 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: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index e183351d047c..189f672bebc1 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -93,7 +93,7 @@ static void omap_gpio_unmask_irq(struct irq_data *d); | |||
93 | static inline struct gpio_bank *omap_irq_data_get_bank(struct irq_data *d) | 93 | static inline struct gpio_bank *omap_irq_data_get_bank(struct irq_data *d) |
94 | { | 94 | { |
95 | struct gpio_chip *chip = irq_data_get_irq_chip_data(d); | 95 | struct gpio_chip *chip = irq_data_get_irq_chip_data(d); |
96 | return container_of(chip, struct gpio_bank, chip); | 96 | return gpiochip_get_data(chip); |
97 | } | 97 | } |
98 | 98 | ||
99 | static void omap_set_gpio_direction(struct gpio_bank *bank, int gpio, | 99 | static void omap_set_gpio_direction(struct gpio_bank *bank, int gpio, |
@@ -661,7 +661,7 @@ static int omap_gpio_wake_enable(struct irq_data *d, unsigned int enable) | |||
661 | 661 | ||
662 | static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) | 662 | static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) |
663 | { | 663 | { |
664 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); | 664 | struct gpio_bank *bank = gpiochip_get_data(chip); |
665 | unsigned long flags; | 665 | unsigned long flags; |
666 | 666 | ||
667 | /* | 667 | /* |
@@ -681,7 +681,7 @@ static int omap_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
681 | 681 | ||
682 | static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) | 682 | static void omap_gpio_free(struct gpio_chip *chip, unsigned offset) |
683 | { | 683 | { |
684 | struct gpio_bank *bank = container_of(chip, struct gpio_bank, chip); | 684 | struct gpio_bank *bank = gpiochip_get_data(chip); |
685 | unsigned long flags; | 685 | unsigned long flags; |
686 | 686 | ||
687 | raw_spin_lock_irqsave(&bank->lock, flags); | 687 | raw_spin_lock_irqsave(&bank->lock, flags); |
@@ -954,7 +954,7 @@ static int omap_gpio_get_direction(struct gpio_chip *chip, unsigned offset) | |||
954 | void __iomem *reg; | 954 | void __iomem *reg; |
955 | int dir; | 955 | int dir; |
956 | 956 | ||
957 | bank = container_of(chip, struct gpio_bank, chip); | 957 | bank = gpiochip_get_data(chip); |
958 | reg = bank->base + bank->regs->direction; | 958 | reg = bank->base + bank->regs->direction; |
959 | raw_spin_lock_irqsave(&bank->lock, flags); | 959 | raw_spin_lock_irqsave(&bank->lock, flags); |
960 | dir = !!(readl_relaxed(reg) & BIT(offset)); | 960 | dir = !!(readl_relaxed(reg) & BIT(offset)); |
@@ -967,7 +967,7 @@ static int omap_gpio_input(struct gpio_chip *chip, unsigned offset) | |||
967 | struct gpio_bank *bank; | 967 | struct gpio_bank *bank; |
968 | unsigned long flags; | 968 | unsigned long flags; |
969 | 969 | ||
970 | bank = container_of(chip, struct gpio_bank, chip); | 970 | bank = gpiochip_get_data(chip); |
971 | raw_spin_lock_irqsave(&bank->lock, flags); | 971 | raw_spin_lock_irqsave(&bank->lock, flags); |
972 | omap_set_gpio_direction(bank, offset, 1); | 972 | omap_set_gpio_direction(bank, offset, 1); |
973 | raw_spin_unlock_irqrestore(&bank->lock, flags); | 973 | raw_spin_unlock_irqrestore(&bank->lock, flags); |
@@ -978,7 +978,7 @@ static int omap_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
978 | { | 978 | { |
979 | struct gpio_bank *bank; | 979 | struct gpio_bank *bank; |
980 | 980 | ||
981 | bank = container_of(chip, struct gpio_bank, chip); | 981 | bank = gpiochip_get_data(chip); |
982 | 982 | ||
983 | if (omap_gpio_is_input(bank, offset)) | 983 | if (omap_gpio_is_input(bank, offset)) |
984 | return omap_get_gpio_datain(bank, offset); | 984 | return omap_get_gpio_datain(bank, offset); |
@@ -991,7 +991,7 @@ static int omap_gpio_output(struct gpio_chip *chip, unsigned offset, int value) | |||
991 | struct gpio_bank *bank; | 991 | struct gpio_bank *bank; |
992 | unsigned long flags; | 992 | unsigned long flags; |
993 | 993 | ||
994 | bank = container_of(chip, struct gpio_bank, chip); | 994 | bank = gpiochip_get_data(chip); |
995 | raw_spin_lock_irqsave(&bank->lock, flags); | 995 | raw_spin_lock_irqsave(&bank->lock, flags); |
996 | bank->set_dataout(bank, offset, value); | 996 | bank->set_dataout(bank, offset, value); |
997 | omap_set_gpio_direction(bank, offset, 0); | 997 | omap_set_gpio_direction(bank, offset, 0); |
@@ -1005,7 +1005,7 @@ static int omap_gpio_debounce(struct gpio_chip *chip, unsigned offset, | |||
1005 | struct gpio_bank *bank; | 1005 | struct gpio_bank *bank; |
1006 | unsigned long flags; | 1006 | unsigned long flags; |
1007 | 1007 | ||
1008 | bank = container_of(chip, struct gpio_bank, chip); | 1008 | bank = gpiochip_get_data(chip); |
1009 | 1009 | ||
1010 | raw_spin_lock_irqsave(&bank->lock, flags); | 1010 | raw_spin_lock_irqsave(&bank->lock, flags); |
1011 | omap2_set_gpio_debounce(bank, offset, debounce); | 1011 | omap2_set_gpio_debounce(bank, offset, debounce); |
@@ -1019,7 +1019,7 @@ static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
1019 | struct gpio_bank *bank; | 1019 | struct gpio_bank *bank; |
1020 | unsigned long flags; | 1020 | unsigned long flags; |
1021 | 1021 | ||
1022 | bank = container_of(chip, struct gpio_bank, chip); | 1022 | bank = gpiochip_get_data(chip); |
1023 | raw_spin_lock_irqsave(&bank->lock, flags); | 1023 | raw_spin_lock_irqsave(&bank->lock, flags); |
1024 | bank->set_dataout(bank, offset, value); | 1024 | bank->set_dataout(bank, offset, value); |
1025 | raw_spin_unlock_irqrestore(&bank->lock, flags); | 1025 | raw_spin_unlock_irqrestore(&bank->lock, flags); |
@@ -1098,7 +1098,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) | |||
1098 | } | 1098 | } |
1099 | bank->chip.ngpio = bank->width; | 1099 | bank->chip.ngpio = bank->width; |
1100 | 1100 | ||
1101 | ret = gpiochip_add(&bank->chip); | 1101 | ret = gpiochip_add_data(&bank->chip, bank); |
1102 | if (ret) { | 1102 | if (ret) { |
1103 | dev_err(bank->dev, "Could not register gpio chip %d\n", ret); | 1103 | dev_err(bank->dev, "Could not register gpio chip %d\n", ret); |
1104 | return ret; | 1104 | return ret; |