diff mbox series

[v1] irq: Set IRQF_COND_ONESHOT in request_irq()

Message ID 5800834.DvuYhMxLoT@rjwysocki.net (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series [v1] irq: Set IRQF_COND_ONESHOT in request_irq() | expand

Commit Message

Rafael J. Wysocki July 11, 2024, 10:20 a.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

The callers of request_irq() don't care about IRQF_ONESHOT because they
don't provide threaded handlers, but if they happen to share the IRQ
with the ACPI SCI, which has a threaded handler and sets IRQF_ONESHOT,
request_irq() will fail for them due to a flags mismatch.

Address this by making request_irq() add IRQF_COND_ONESHOT to the flags
passed to request_threaded_irq() for all of its callers.

Fixes: 7a36b901a6eb ("ACPI: OSL: Use a threaded interrupt handler for SCI")
Closes: https://lore.kernel.org/lkml/205bd84a-fe8e-4963-968e-0763285f35ba@message-id.googlemail.com
Reported-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
Tested-by: Stefan Seyfried <stefan.seyfried@googlemail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 include/linux/interrupt.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Thomas Gleixner July 11, 2024, 8:32 p.m. UTC | #1
On Thu, Jul 11 2024 at 12:20, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The callers of request_irq() don't care about IRQF_ONESHOT because they
> don't provide threaded handlers, but if they happen to share the IRQ
> with the ACPI SCI, which has a threaded handler and sets IRQF_ONESHOT,
> request_irq() will fail for them due to a flags mismatch.
>
> Address this by making request_irq() add IRQF_COND_ONESHOT to the flags
> passed to request_threaded_irq() for all of its callers.

In principle that should work. We'll see whether there are dragons
lurking :)

Thanks,

        tglx
diff mbox series

Patch

Index: linux-pm/include/linux/interrupt.h
===================================================================
--- linux-pm.orig/include/linux/interrupt.h
+++ linux-pm/include/linux/interrupt.h
@@ -168,7 +168,8 @@  static inline int __must_check
 request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
 	    const char *name, void *dev)
 {
-	return request_threaded_irq(irq, handler, NULL, flags, name, dev);
+	return request_threaded_irq(irq, handler, NULL,
+				    flags | IRQF_COND_ONESHOT, name, dev);
 }
 
 extern int __must_check