Skip to content

Commit 8c00914

Browse files
Jiawen WuBartosz Golaszewski
authored andcommitted
gpiolib: Fix GPIO chip IRQ initialization restriction
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: 5467801 ("gpio: Restrict usage of GPIO chip irq members before initialization") Signed-off-by: Jiawen Wu <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 858fd16 commit 8c00914

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/gpio/gpiolib.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,6 +1792,14 @@ int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
17921792
gc->to_irq = gpiochip_to_irq;
17931793
gc->irq.domain = domain;
17941794

1795+
/*
1796+
* Using barrier() here to prevent compiler from reordering
1797+
* gc->irq.initialized before adding irqdomain.
1798+
*/
1799+
barrier();
1800+
1801+
gc->irq.initialized = true;
1802+
17951803
return 0;
17961804
}
17971805
EXPORT_SYMBOL_GPL(gpiochip_irqchip_add_domain);

0 commit comments

Comments
 (0)