aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/pm.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-08-28 16:50:43 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-01 07:48:29 -0400
commitc4df606c40c3ac8ba76ad11fdbb10139f7fbb261 (patch)
tree92451694842414adefc023fc454e12ac0f8446e7 /kernel/irq/pm.c
parent092fadd59b50208f6859f89dd7ea84e03955b544 (diff)
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>
Diffstat (limited to 'kernel/irq/pm.c')
-rw-r--r--kernel/irq/pm.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index a21b3dc9825a..cf0ce0163db9 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -49,10 +49,10 @@ void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action)
49 desc->no_suspend_depth--; 49 desc->no_suspend_depth--;
50} 50}
51 51
52static void suspend_device_irq(struct irq_desc *desc, int irq) 52static bool suspend_device_irq(struct irq_desc *desc, int irq)
53{ 53{
54 if (!desc->action || desc->no_suspend_depth) 54 if (!desc->action || desc->no_suspend_depth)
55 return; 55 return false;
56 56
57 desc->istate |= IRQS_SUSPENDED; 57 desc->istate |= IRQS_SUSPENDED;
58 __disable_irq(desc, irq); 58 __disable_irq(desc, irq);
@@ -65,6 +65,7 @@ static void suspend_device_irq(struct irq_desc *desc, int irq)
65 */ 65 */
66 if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND) 66 if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
67 mask_irq(desc); 67 mask_irq(desc);
68 return true;
68} 69}
69 70
70/** 71/**
@@ -86,15 +87,15 @@ void suspend_device_irqs(void)
86 87
87 for_each_irq_desc(irq, desc) { 88 for_each_irq_desc(irq, desc) {
88 unsigned long flags; 89 unsigned long flags;
90 bool sync;
89 91
90 raw_spin_lock_irqsave(&desc->lock, flags); 92 raw_spin_lock_irqsave(&desc->lock, flags);
91 suspend_device_irq(desc, irq); 93 sync = suspend_device_irq(desc, irq);
92 raw_spin_unlock_irqrestore(&desc->lock, flags); 94 raw_spin_unlock_irqrestore(&desc->lock, flags);
93 }
94 95
95 for_each_irq_desc(irq, desc) 96 if (sync)
96 if (desc->istate & IRQS_SUSPENDED)
97 synchronize_irq(irq); 97 synchronize_irq(irq);
98 }
98} 99}
99EXPORT_SYMBOL_GPL(suspend_device_irqs); 100EXPORT_SYMBOL_GPL(suspend_device_irqs);
100 101