linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
@ 2016-01-07  0:20 Guenter Roeck
  2016-01-07  9:07 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2016-01-07  0:20 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, Michal Simek, linux-gpio, linux-arm-kernel,
	linux-kernel, Guenter Roeck

Commit 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer") replaces
the use of container_of() with gpiochip_get_data(). Unfortunately, the
data pointer is not yet set by the time xgpio_save_regs() is called,
causing a system hang.

Fixes: 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
It might make sense to merge this patch with the patch introducing the problem.

 drivers/gpio/gpio-xilinx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 3345ab0ba1b3..d0fbb7f99523 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -207,7 +207,8 @@ static int xgpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
  */
 static void xgpio_save_regs(struct of_mm_gpio_chip *mm_gc)
 {
-	struct xgpio_instance *chip = gpiochip_get_data(&mm_gc->gc);
+	struct xgpio_instance *chip =
+		container_of(mm_gc, struct xgpio_instance, mmchip);
 
 	xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET,	chip->gpio_state[0]);
 	xgpio_writereg(mm_gc->regs + XGPIO_TRI_OFFSET, chip->gpio_dir[0]);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
  2016-01-07  0:20 [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() Guenter Roeck
@ 2016-01-07  9:07 ` Linus Walleij
  2016-01-07 14:49   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2016-01-07  9:07 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Alexandre Courbot, Michal Simek, linux-gpio, linux-arm-kernel,
	linux-kernel

On Thu, Jan 7, 2016 at 1:20 AM, Guenter Roeck <linux@roeck-us.net> wrote:

> Commit 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer") replaces
> the use of container_of() with gpiochip_get_data(). Unfortunately, the
> data pointer is not yet set by the time xgpio_save_regs() is called,
> causing a system hang.
>
> Fixes: 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> It might make sense to merge this patch with the patch introducing the problem.

Patch applied, thanks for finding and fixing this so quick!

(I hope I haven't created too many of these regressions...)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
  2016-01-07  9:07 ` Linus Walleij
@ 2016-01-07 14:49   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2016-01-07 14:49 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, Michal Simek, linux-gpio, linux-arm-kernel,
	linux-kernel

On 01/07/2016 01:07 AM, Linus Walleij wrote:
> On Thu, Jan 7, 2016 at 1:20 AM, Guenter Roeck <linux@roeck-us.net> wrote:
>
>> Commit 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer") replaces
>> the use of container_of() with gpiochip_get_data(). Unfortunately, the
>> data pointer is not yet set by the time xgpio_save_regs() is called,
>> causing a system hang.
>>
>> Fixes: 097d88e94c44 ("gpio: xilinx: use gpiochip data pointer")
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>> It might make sense to merge this patch with the patch introducing the problem.
>
> Patch applied, thanks for finding and fixing this so quick!
>
Code inspection shows that there are two more - I'll send patches today.

Guenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-07 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07  0:20 [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() Guenter Roeck
2016-01-07  9:07 ` Linus Walleij
2016-01-07 14:49   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).