aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/pm.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-07-15 07:03:20 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-07-23 03:37:51 -0400
commit3a79bc63d90750f737ab9d7219bd3091d2fd6d84 (patch)
tree57aee43684c7c9c83eff53b6e8ea765975ab5b55 /kernel/irq/pm.c
parent5f9e832c137075045d15cd6899ab0505cfb2ca4b (diff)
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>
Diffstat (limited to 'kernel/irq/pm.c')
-rw-r--r--kernel/irq/pm.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index d6961d3c6f9e..8f557fa1f4fe 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -177,6 +177,26 @@ static void resume_irqs(bool want_early)
177} 177}
178 178
179/** 179/**
180 * rearm_wake_irq - rearm a wakeup interrupt line after signaling wakeup
181 * @irq: Interrupt to rearm
182 */
183void 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
199/**
180 * irq_pm_syscore_ops - enable interrupt lines early 200 * irq_pm_syscore_ops - enable interrupt lines early
181 * 201 *
182 * Enable all interrupt lines with %IRQF_EARLY_RESUME set. 202 * Enable all interrupt lines with %IRQF_EARLY_RESUME set.