* [PATCH v2] pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error
@ 2016-05-04 8:21 Geert Uytterhoeven
2016-05-11 11:29 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2016-05-04 8:21 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: Laurent Pinchart, linux-gpio, linux-renesas-soc, Geert Uytterhoeven
Currrently the gpio_chip.to_irq() callback returns -ENOSYS on error,
which causes bad interactions with the serial_mctrl_gpio helpers.
mctrl_gpio_init() returns -ENOSYS if GPIOLIB is not enabled, which is
intended to be ignored by its callers. However, ignoring -ENOSYS when it
was caused by a gpiod_to_irq() failure will lead to a crash later:
Unable to handle kernel paging request at virtual address ffffffde
...
PC is at mctrl_gpio_set+0x14/0x78
Fix this by returning zero instead, like gpiochip_to_irq() does.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This depends on "gpio: make gpiod_to_irq() return negative for NO_IRQ"
for proper handling by callers of mctrl_gpio_init().
Hence I think it's best to take this through the GPIO tree, after the
above has been applied.
v2:
- Return zero instead of -ENXIO.
---
drivers/pinctrl/sh-pfc/gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c
index a6681b8b17c3b30c..97dff6a09ff08115 100644
--- a/drivers/pinctrl/sh-pfc/gpio.c
+++ b/drivers/pinctrl/sh-pfc/gpio.c
@@ -212,7 +212,7 @@ static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset)
}
}
- return -ENOSYS;
+ return 0;
found:
return pfc->irqs[i];
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error
2016-05-04 8:21 [PATCH v2] pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error Geert Uytterhoeven
@ 2016-05-11 11:29 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-05-11 11:29 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Alexandre Courbot, Laurent Pinchart, linux-gpio, linux-renesas-soc
On Wed, May 4, 2016 at 10:21 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Currrently the gpio_chip.to_irq() callback returns -ENOSYS on error,
> which causes bad interactions with the serial_mctrl_gpio helpers.
>
> mctrl_gpio_init() returns -ENOSYS if GPIOLIB is not enabled, which is
> intended to be ignored by its callers. However, ignoring -ENOSYS when it
> was caused by a gpiod_to_irq() failure will lead to a crash later:
>
> Unable to handle kernel paging request at virtual address ffffffde
> ...
> PC is at mctrl_gpio_set+0x14/0x78
>
> Fix this by returning zero instead, like gpiochip_to_irq() does.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> This depends on "gpio: make gpiod_to_irq() return negative for NO_IRQ"
> for proper handling by callers of mctrl_gpio_init().
> Hence I think it's best to take this through the GPIO tree, after the
> above has been applied.
>
> v2:
> - Return zero instead of -ENXIO.
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-11 11:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 8:21 [PATCH v2] pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error Geert Uytterhoeven
2016-05-11 11:29 ` Linus Walleij
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.