diff mbox series

gpiolib: Fix GPIO chip IRQ initialization restriction

Message ID 20230529074227.636933-1-jiawenwu@trustnetic.com
State New
Headers show
Series gpiolib: Fix GPIO chip IRQ initialization restriction | expand

Commit Message

Jiawen Wu May 29, 2023, 7:42 a.m. UTC
In case of gpio-regmap, IRQ chip is added by regmap-irq and associated with
GPIO chip by gpiochip_irqchip_add_domain(). The initialization flag was not
added in gpiochip_irqchip_add_domain(), causing gpiochip_to_irq() to return
-EPROBE_DEFER.

Fixes: 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: shreeya.patel@collabora.com
---
 drivers/gpio/gpiolib.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Andy Shevchenko May 31, 2023, 3:27 a.m. UTC | #1
On Mon, May 29, 2023 at 10:44 AM Jiawen Wu <jiawenwu@trustnetic.com> wrote:
>
> In case of gpio-regmap, IRQ chip is added by regmap-irq and associated with
> GPIO chip by gpiochip_irqchip_add_domain(). The initialization flag was not
> added in gpiochip_irqchip_add_domain(), causing gpiochip_to_irq() to return
> -EPROBE_DEFER.

Makes sense to me.

> Fixes: 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization")
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>

> Cc: shreeya.patel@collabora.com

This can be replaced with the --cc option.

...

>         gc->to_irq = gpiochip_to_irq;
>         gc->irq.domain = domain;

I'm wondering if you need the same (compiler) barrier here as in the
other place.

> +       gc->irq.initialized = true;

--
With Best Regards,
Andy Shevchenko
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 04fb05df805b..1b6cd4ffb761 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1789,6 +1789,7 @@  int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
 
 	gc->to_irq = gpiochip_to_irq;
 	gc->irq.domain = domain;
+	gc->irq.initialized = true;
 
 	return 0;
 }