Skip to content

Commit 501ef0f

Browse files
geertulinusw
authored andcommitted
gpio: rcar: Check for irq_set_irq_wake() failures
If an interrupt controller doesn't support wake-up configuration, irq_set_irq_wake() returns an error code. Then any subsequent call trying to deconfigure wake-up will cause an imbalance, and a warning will be printed: WARNING: CPU: 1 PID: 1341 at kernel/irq/manage.c:540 irq_set_irq_wake+0x9c/0xf8() Unbalanced IRQ 26 wake disable To fix this, refrain from any further parent interrupt controller (de)configuration if irq_set_irq_wake() failed. Alternative fixes would be: - calling "gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE)" from the platform code, - setting "gic_chip.flags = IRQCHIP_SKIP_SET_WAKE" in the GIC driver code, but these were withheld as the GIC hardware doesn't really support wake-up interrupts. Fixes: ab82fa7 ("gpio: rcar: Prevent module clock disable when wake-up is enabled") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 3fff99b commit 501ef0f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/gpio/gpio-rcar.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,17 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
177177
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
178178
struct gpio_rcar_priv *p = container_of(gc, struct gpio_rcar_priv,
179179
gpio_chip);
180-
181-
irq_set_irq_wake(p->irq_parent, on);
180+
int error;
181+
182+
if (p->irq_parent) {
183+
error = irq_set_irq_wake(p->irq_parent, on);
184+
if (error) {
185+
dev_dbg(&p->pdev->dev,
186+
"irq %u doesn't support irq_set_wake\n",
187+
p->irq_parent);
188+
p->irq_parent = 0;
189+
}
190+
}
182191

183192
if (!p->clk)
184193
return 0;

0 commit comments

Comments
 (0)