Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303209 > unrolled thread

[PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()

Started byGuenter Roeck <linux@roeck-us.net>
First post2016-01-07 01:30 +0100
Last post2016-01-07 16:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() Guenter Roeck <linux@roeck-us.net> - 2016-01-07 01:30 +0100
    Re: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() Linus Walleij <linus.walleij@linaro.org> - 2016-01-07 10:10 +0100
      Re: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in  xgpio_save_regs() Guenter Roeck <linux@roeck-us.net> - 2016-01-07 16:00 +0100

#1303209 — [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()

FromGuenter Roeck <linux@roeck-us.net>
Date2016-01-07 01:30 +0100
Subject[PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
Message-ID<qO6CJ-al-11@gated-at.bofh.it>
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

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

[toc] | [next] | [standalone]


#1303384

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-01-07 10:10 +0100
Message-ID<qOeJX-61z-7@gated-at.bofh.it>
In reply to#1303209
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1303633 — Re: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()

FromGuenter Roeck <linux@roeck-us.net>
Date2016-01-07 16:00 +0100
SubjectRe: [PATCH -next] gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs()
Message-ID<qOkcG-137-5@gated-at.bofh.it>
In reply to#1303384
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

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web