Skip to content

Commit 3a79bc6

Browse files
committed
PCI: irq: Introduce rearm_wake_irq()
Introduce a new function, rearm_wake_irq(), allowing a wakeup IRQ to be armed for systen wakeup detection again without running any action handlers associated with it after it has been armed for wakeup detection and triggered. That is useful for IRQs, like ACPI SCI, that may deliver wakeup as well as non-wakeup interrupts when armed for systen wakeup detection. In those cases, it may be possible to determine whether or not the delivered interrupt is a systen wakeup one without running the entire action handler (or handlers, if the IRQ is shared) for the IRQ, and if the interrupt turns out to be a non-wakeup one, the IRQ can be rearmed with the help of the new function. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 5f9e832 commit 3a79bc6

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎include/linux/interrupt.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ extern void teardown_percpu_nmi(unsigned int irq);
238238
/* The following three functions are for the core kernel use only. */
239239
extern void suspend_device_irqs(void);
240240
extern void resume_device_irqs(void);
241+
extern void rearm_wake_irq(unsigned int irq);
241242

242243
/**
243244
* struct irq_affinity_notify - context for notification of IRQ affinity changes

‎kernel/irq/pm.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,26 @@ static void resume_irqs(bool want_early)
176176
}
177177
}
178178

179+
/**
180+
* rearm_wake_irq - rearm a wakeup interrupt line after signaling wakeup
181+
* @irq: Interrupt to rearm
182+
*/
183+
void rearm_wake_irq(unsigned int irq)
184+
{
185+
unsigned long flags;
186+
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
187+
188+
if (!desc || !(desc->istate & IRQS_SUSPENDED) ||
189+
!irqd_is_wakeup_set(&desc->irq_data))
190+
return;
191+
192+
desc->istate &= ~IRQS_SUSPENDED;
193+
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
194+
__enable_irq(desc);
195+
196+
irq_put_desc_busunlock(desc, flags);
197+
}
198+
179199
/**
180200
* irq_pm_syscore_ops - enable interrupt lines early
181201
*

0 commit comments

Comments
 (0)