diff mbox

[052/182] gpio: pxa: use gpiochip data pointer

Message ID 1449667312-32244-1-git-send-email-linus.walleij@linaro.org
State New
Headers show

Commit Message

Linus Walleij Dec. 9, 2015, 1:21 p.m. UTC
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: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Daniel Mack <zonque@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/gpio/gpio-pxa.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Linus Walleij Dec. 13, 2015, 8:19 p.m. UTC | #1
On Wed, Dec 9, 2015 at 10:54 PM, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Linus Walleij <linus.walleij@linaro.org> writes:

>

>> 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: Robert Jarzmik <robert.jarzmik@free.fr>

>> Cc: Daniel Mack <zonque@gmail.com>

>> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

>

> This conflicts with the earlier serie in https://lkml.org/lkml/2015/11/28/136

> which revamps the gpio_chip_base() anyway.


I have already fixed that, I think.

> The patch is perfectly fine, and yet it's the opportunity to ask a review of the

> other serie before other patches make me respin the serie, isn't it ?


I merged it and rebased my patch.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index bce99182578b..1f574a9f88fe 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -153,7 +153,8 @@  static struct pxa_gpio_id pxa1928_id = {
 
 static inline void __iomem *gpio_chip_base(struct gpio_chip *c)
 {
-	return container_of(c, struct pxa_gpio_chip, chip)->regbase;
+	struct pxa_gpio_chip *p = gpiochip_get_data(c);
+	return p->regbase;
 }
 
 static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
@@ -334,7 +335,7 @@  static int pxa_init_gpio_chip(int gpio_end,
 
 		/* number of GPIOs on last bank may be less than 32 */
 		c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
-		gpiochip_add(c);
+		gpiochip_add_data(c, &chips[i]);
 	}
 	pxa_gpio_chips = chips;
 	return 0;