* [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer
@ 2015-12-09 13:41 Linus Walleij
2015-12-09 23:27 ` Michael Welling
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2015-12-09 13:41 UTC (permalink / raw)
To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
Markus Pargmann, Anatolij Gustschin, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman
Cc: Linus Walleij
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: Anatolij Gustschin <agust@denx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Power maintainers: please ACK this. I cannot really say if this
should ideally be broken out as a separate driver in drivers/gpio
or if it is better to keep it here. For now just refactoring...
---
arch/powerpc/platforms/52xx/mpc52xx_gpt.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index 3048e34db6d8..f112e96ab8a3 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -278,14 +278,9 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
* GPIOLIB hooks
*/
#if defined(CONFIG_GPIOLIB)
-static inline struct mpc52xx_gpt_priv *gc_to_mpc52xx_gpt(struct gpio_chip *gc)
-{
- return container_of(gc, struct mpc52xx_gpt_priv, gc);
-}
-
static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
{
- struct mpc52xx_gpt_priv *gpt = gc_to_mpc52xx_gpt(gc);
+ struct mpc52xx_gpt_priv *gpt = gpiochip_get_data(gc);
return (in_be32(&gpt->regs->status) >> 8) & 1;
}
@@ -293,7 +288,7 @@ static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
static void
mpc52xx_gpt_gpio_set(struct gpio_chip *gc, unsigned int gpio, int v)
{
- struct mpc52xx_gpt_priv *gpt = gc_to_mpc52xx_gpt(gc);
+ struct mpc52xx_gpt_priv *gpt = gpiochip_get_data(gc);
unsigned long flags;
u32 r;
@@ -307,7 +302,7 @@ mpc52xx_gpt_gpio_set(struct gpio_chip *gc, unsigned int gpio, int v)
static int mpc52xx_gpt_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
{
- struct mpc52xx_gpt_priv *gpt = gc_to_mpc52xx_gpt(gc);
+ struct mpc52xx_gpt_priv *gpt = gpiochip_get_data(gc);
unsigned long flags;
dev_dbg(gpt->dev, "%s: gpio:%d\n", __func__, gpio);
@@ -354,7 +349,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
MPC52xx_GPT_MODE_MS_GPIO);
- rc = gpiochip_add(&gpt->gc);
+ rc = gpiochip_add_data(&gpt->gc, gpt);
if (rc)
dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);
--
2.4.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer
2015-12-09 13:41 [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer Linus Walleij
@ 2015-12-09 23:27 ` Michael Welling
2015-12-13 21:02 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Michael Welling @ 2015-12-09 23:27 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Johan Hovold, Alexandre Courbot, Markus Pargmann,
Anatolij Gustschin, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman
On Wed, Dec 09, 2015 at 02:41:06PM +0100, Linus Walleij wrote:
> @@ -354,7 +349,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
> clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
> MPC52xx_GPT_MODE_MS_GPIO);
>
> - rc = gpiochip_add(&gpt->gc);
> + rc = gpiochip_add_data(&gpt->gc, gpt);
> if (rc)
Another place that dev_err references gpiochip_add instead of gpiochip_add_data.
> dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);
>
Other places with references not associated with patches:
Documentation/zh_CN/gpio.txt
Documentation/gpio/gpio-legacy.txt
Documentation/gpio/driver.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer
2015-12-09 23:27 ` Michael Welling
@ 2015-12-13 21:02 ` Linus Walleij
2015-12-13 23:01 ` Michael Welling
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2015-12-13 21:02 UTC (permalink / raw)
To: Michael Welling
Cc: linux-gpio, Johan Hovold, Alexandre Courbot, Markus Pargmann,
Anatolij Gustschin, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman
On Thu, Dec 10, 2015 at 12:27 AM, Michael Welling <mwelling@ieee.org> wrote:
> On Wed, Dec 09, 2015 at 02:41:06PM +0100, Linus Walleij wrote:
>> @@ -354,7 +349,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
>> clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
>> MPC52xx_GPT_MODE_MS_GPIO);
>>
>> - rc = gpiochip_add(&gpt->gc);
>> + rc = gpiochip_add_data(&gpt->gc, gpt);
>> if (rc)
>
> Another place that dev_err references gpiochip_add instead of gpiochip_add_data.
>
>> dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);
OK fixed it.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer
2015-12-13 21:02 ` Linus Walleij
@ 2015-12-13 23:01 ` Michael Welling
0 siblings, 0 replies; 4+ messages in thread
From: Michael Welling @ 2015-12-13 23:01 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Johan Hovold, Alexandre Courbot, Markus Pargmann,
Anatolij Gustschin, Benjamin Herrenschmidt, Paul Mackerras,
Michael Ellerman
On Sun, Dec 13, 2015 at 10:02:20PM +0100, Linus Walleij wrote:
> On Thu, Dec 10, 2015 at 12:27 AM, Michael Welling <mwelling@ieee.org> wrote:
> > On Wed, Dec 09, 2015 at 02:41:06PM +0100, Linus Walleij wrote:
> >> @@ -354,7 +349,7 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
> >> clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
> >> MPC52xx_GPT_MODE_MS_GPIO);
> >>
> >> - rc = gpiochip_add(&gpt->gc);
> >> + rc = gpiochip_add_data(&gpt->gc, gpt);
> >> if (rc)
> >
> > Another place that dev_err references gpiochip_add instead of gpiochip_add_data.
> >
> >> dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);
>
> OK fixed it.
Sorry for nit picking.
The series otherwises looks good.
Reviewed-by: Michael Welling <mwelling@ieee.org>
>
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-12-13 23:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 13:41 [PATCH 143/182] powerpc: mpc52xx_gpt: use gpiochip data pointer Linus Walleij
2015-12-09 23:27 ` Michael Welling
2015-12-13 21:02 ` Linus Walleij
2015-12-13 23:01 ` Michael Welling
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.