[PATCH] genirq: Fix gpio irq will fail to be resend under certain conditions

From: Zhenze Zhuang
Date: Sat Jun 08 2024 - 12:35:46 EST


When a gpio irq is disable and the wakeup function is enable, and
the device enters suspend, the irq wakeup is triggered but then enters
suspend, the IRQS_REPLAY flag will be set, but the IRQS_REPLAY will
not be cleared because the irq_may_run() condition is not met. After
the gpio irq is enabled and the suspend is entered again, after the
gpio irq is triggered, the check_irq_resend() execution will fail
because the IRQS_REPLAY is asserted, resulting in the interrupt not
being resned.

Signed-off-by: Zhenze Zhuang <luuiiruo@xxxxxxx>
---
kernel/irq/chip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index dc94e0bf2c94..8800db8d655c 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -690,6 +690,8 @@ void handle_fasteoi_irq(struct irq_desc *desc)

raw_spin_lock(&desc->lock);

+ desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
+
/*
* When an affinity change races with IRQ handling, the next interrupt
* can arrive on the new CPU before the original CPU has completed
@@ -701,8 +703,6 @@ void handle_fasteoi_irq(struct irq_desc *desc)
goto out;
}

- desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
-
/*
* If its disabled or no action available
* then mask it and get out of here:
--
2.34.1