Skip to content

Commit

Permalink
PCI: irq: Introduce rearm_wake_irq()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki committed Jul 23, 2019
1 parent 5f9e832 commit 3a79bc6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ extern void teardown_percpu_nmi(unsigned int irq);
/* The following three functions are for the core kernel use only. */
extern void suspend_device_irqs(void);
extern void resume_device_irqs(void);
extern void rearm_wake_irq(unsigned int irq);

/**
* struct irq_affinity_notify - context for notification of IRQ affinity changes
Expand Down
20 changes: 20 additions & 0 deletions kernel/irq/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,26 @@ static void resume_irqs(bool want_early)
}
}

/**
* rearm_wake_irq - rearm a wakeup interrupt line after signaling wakeup
* @irq: Interrupt to rearm
*/
void rearm_wake_irq(unsigned int irq)
{
unsigned long flags;
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);

if (!desc || !(desc->istate & IRQS_SUSPENDED) ||
!irqd_is_wakeup_set(&desc->irq_data))
return;

desc->istate &= ~IRQS_SUSPENDED;
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
__enable_irq(desc);

irq_put_desc_busunlock(desc, flags);
}

/**
* irq_pm_syscore_ops - enable interrupt lines early
*
Expand Down

0 comments on commit 3a79bc6

Please sign in to comment.