Skip to content

Commit 99e5730

Browse files
committed
Merge tag 'irq-no-autoen-2021-03-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into exynos-drm-next
Tag for the input subsystem to pick up
2 parents fe8a057 + cbe16f3 commit 99e5730

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

include/linux/interrupt.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
* interrupt handler after suspending interrupts. For system
6262
* wakeup devices users need to implement wakeup detection in
6363
* their interrupt handlers.
64+
* IRQF_NO_AUTOEN - Don't enable IRQ or NMI automatically when users request it.
65+
* Users will enable it explicitly by enable_irq() or enable_nmi()
66+
* later.
6467
*/
6568
#define IRQF_SHARED 0x00000080
6669
#define IRQF_PROBE_SHARED 0x00000100
@@ -74,6 +77,7 @@
7477
#define IRQF_NO_THREAD 0x00010000
7578
#define IRQF_EARLY_RESUME 0x00020000
7679
#define IRQF_COND_SUSPEND 0x00040000
80+
#define IRQF_NO_AUTOEN 0x00080000
7781

7882
#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
7983

kernel/irq/manage.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
16931693
irqd_set(&desc->irq_data, IRQD_NO_BALANCING);
16941694
}
16951695

1696-
if (irq_settings_can_autoenable(desc)) {
1696+
if (!(new->flags & IRQF_NO_AUTOEN) &&
1697+
irq_settings_can_autoenable(desc)) {
16971698
irq_startup(desc, IRQ_RESEND, IRQ_START_COND);
16981699
} else {
16991700
/*
@@ -2086,10 +2087,15 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
20862087
* which interrupt is which (messes up the interrupt freeing
20872088
* logic etc).
20882089
*
2090+
* Also shared interrupts do not go well with disabling auto enable.
2091+
* The sharing interrupt might request it while it's still disabled
2092+
* and then wait for interrupts forever.
2093+
*
20892094
* Also IRQF_COND_SUSPEND only makes sense for shared interrupts and
20902095
* it cannot be set along with IRQF_NO_SUSPEND.
20912096
*/
20922097
if (((irqflags & IRQF_SHARED) && !dev_id) ||
2098+
((irqflags & IRQF_SHARED) && (irqflags & IRQF_NO_AUTOEN)) ||
20932099
(!(irqflags & IRQF_SHARED) && (irqflags & IRQF_COND_SUSPEND)) ||
20942100
((irqflags & IRQF_NO_SUSPEND) && (irqflags & IRQF_COND_SUSPEND)))
20952101
return -EINVAL;
@@ -2245,7 +2251,8 @@ int request_nmi(unsigned int irq, irq_handler_t handler,
22452251

22462252
desc = irq_to_desc(irq);
22472253

2248-
if (!desc || irq_settings_can_autoenable(desc) ||
2254+
if (!desc || (irq_settings_can_autoenable(desc) &&
2255+
!(irqflags & IRQF_NO_AUTOEN)) ||
22492256
!irq_settings_can_request(desc) ||
22502257
WARN_ON(irq_settings_is_per_cpu_devid(desc)) ||
22512258
!irq_supports_nmi(desc))

0 commit comments

Comments
 (0)