[PATCH v2 3/3] genirq: Do not test disabled IRQs with DEBUG_SHIRQ

From: Krzysztof Kozlowski
Date: Mon Jun 15 2020 - 04:08:16 EST


Testing events during freeing of disabled shared interrupts
(CONFIG_DEBUG_SHIRQ) leads to false positives. The driver disabled
interrupts on purpose to be sure that they will not fire during device
removal.

Signed-off-by: Krzysztof Kozlowski <krzk@xxxxxxxxxx>

---

Changes since v1:
1. New patch.
---
kernel/irq/manage.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 761911168438..f19f0dedc30d 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1775,12 +1775,14 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id)
/*
* It's a shared IRQ -- the driver ought to be prepared for an IRQ
* event to happen even now it's being freed, so let's make sure that
- * is so by doing an extra call to the handler ....
+ * is so by doing an extra call to the handler.
+ * Although the driver could disable the interrupts just before freeing
+ * just to avoid such trouble - don't test it then.
*
* ( We do this after actually deregistering it, to make sure that a
* 'real' IRQ doesn't run in parallel with our fake. )
*/
- if (action->flags & IRQF_SHARED) {
+ if (action->flags & IRQF_SHARED && !desc->depth) {
local_irq_save(flags);
action->handler(irq, dev_id);
local_irq_restore(flags);
--
2.7.4