[PATCH 1/5] gpio: rcar: don't clobber INTMSK when disabling a single line

From: shao.mingyin

Date: Sat Nov 07 2026 - 03:15:12 EST


From: Shao Mingyin <shao.mingyin@xxxxxxxxxx>

gpio_rcar_irq_disable() writes ~BIT(hwirq) to the whole INTMSK register,
which clears the bit of the line being disabled but sets every other bit
in the bank to 1. Since a set bit in INTMSK means "interrupt enabled"
(gpio_rcar_irq_handler() only handles lines whose INTMSK bit is set),
this disables one GPIO interrupt while collateral-enabling all the
other GPIO interrupts of the bank, which can cause a storm of spurious
cascaded interrupts on level-triggered lines.

Do a read-modify-write to clear only the line being disabled.

Fixes: 119f5e448d32 ("gpio: Renesas R-Car GPIO driver V3")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Shao Mingyin <shao.mingyin@xxxxxxxxxx>
---
drivers/gpio/gpio-rcar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 1192e1f1c6..239d78a2ae 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -129,7 +129,7 @@
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
irq_hw_number_t hwirq = irqd_to_hwirq(d);

- gpio_rcar_write(p, INTMSK, ~BIT(hwirq));
+ gpio_rcar_write(p, INTMSK, gpio_rcar_read(p, INTMSK) & ~BIT(hwirq));
gpiochip_disable_irq(gc, hwirq);
}