Skip to content

Commit c4df606

Browse files
KAGA-KOKOrafaeljw
authored andcommitted
genirq: Avoid double loop on suspend
We can synchronize the suspended interrupts right away. No need for an extra loop. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 092fadd commit c4df606

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎kernel/irq/pm.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action)
4949
desc->no_suspend_depth--;
5050
}
5151

52-
static void suspend_device_irq(struct irq_desc *desc, int irq)
52+
static bool suspend_device_irq(struct irq_desc *desc, int irq)
5353
{
5454
if (!desc->action || desc->no_suspend_depth)
55-
return;
55+
return false;
5656

5757
desc->istate |= IRQS_SUSPENDED;
5858
__disable_irq(desc, irq);
@@ -65,6 +65,7 @@ static void suspend_device_irq(struct irq_desc *desc, int irq)
6565
*/
6666
if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
6767
mask_irq(desc);
68+
return true;
6869
}
6970

7071
/**
@@ -86,15 +87,15 @@ void suspend_device_irqs(void)
8687

8788
for_each_irq_desc(irq, desc) {
8889
unsigned long flags;
90+
bool sync;
8991

9092
raw_spin_lock_irqsave(&desc->lock, flags);
91-
suspend_device_irq(desc, irq);
93+
sync = suspend_device_irq(desc, irq);
9294
raw_spin_unlock_irqrestore(&desc->lock, flags);
93-
}
9495

95-
for_each_irq_desc(irq, desc)
96-
if (desc->istate & IRQS_SUSPENDED)
96+
if (sync)
9797
synchronize_irq(irq);
98+
}
9899
}
99100
EXPORT_SYMBOL_GPL(suspend_device_irqs);
100101

0 commit comments

Comments
 (0)