Skip to content

Commit b76f167

Browse files
KAGA-KOKOrafaeljw
authored andcommitted
genirq: Mark wakeup sources as armed on suspend
This allows us to utilize this information in the irq_may_run() check without adding another conditional to the fast path. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent c7bd3ec commit b76f167

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ struct irq_data {
173173
* IRQD_IRQ_DISABLED - Disabled state of the interrupt
174174
* IRQD_IRQ_MASKED - Masked state of the interrupt
175175
* IRQD_IRQ_INPROGRESS - In progress state of the interrupt
176+
* IRQD_WAKEUP_ARMED - Wakeup mode armed
176177
*/
177178
enum {
178179
IRQD_TRIGGER_MASK = 0xf,
@@ -186,6 +187,7 @@ enum {
186187
IRQD_IRQ_DISABLED = (1 << 16),
187188
IRQD_IRQ_MASKED = (1 << 17),
188189
IRQD_IRQ_INPROGRESS = (1 << 18),
190+
IRQD_WAKEUP_ARMED = (1 << 19),
189191
};
190192

191193
static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -257,6 +259,12 @@ static inline bool irqd_irq_inprogress(struct irq_data *d)
257259
return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
258260
}
259261

262+
static inline bool irqd_is_wakeup_armed(struct irq_data *d)
263+
{
264+
return d->state_use_accessors & IRQD_WAKEUP_ARMED;
265+
}
266+
267+
260268
/*
261269
* Functions for chained handlers which can be enabled/disabled by the
262270
* standard disable_irq/enable_irq calls. Must be called with

‎kernel/irq/pm.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ static bool suspend_device_irq(struct irq_desc *desc, int irq)
5454
if (!desc->action || desc->no_suspend_depth)
5555
return false;
5656

57+
if (irqd_is_wakeup_set(&desc->irq_data))
58+
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
59+
5760
desc->istate |= IRQS_SUSPENDED;
5861
__disable_irq(desc, irq);
5962

@@ -101,6 +104,8 @@ EXPORT_SYMBOL_GPL(suspend_device_irqs);
101104

102105
static void resume_irq(struct irq_desc *desc, int irq)
103106
{
107+
irqd_clear(&desc->irq_data, IRQD_WAKEUP_ARMED);
108+
104109
if (desc->istate & IRQS_SUSPENDED)
105110
goto resume;
106111

0 commit comments

Comments
 (0)