summaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-08-28 22:50:43 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-01 13:48:29 +0200
commitc4df606c40c3ac8ba76ad11fdbb10139f7fbb261 (patch)
tree92451694842414adefc023fc454e12ac0f8446e7 /kernel/irq
parentgenirq: Move MASK_ON_SUSPEND handling into suspend_device_irqs() (diff)
downloadlinux-c4df606c40c3ac8ba76ad11fdbb10139f7fbb261.tar.xz
linux-c4df606c40c3ac8ba76ad11fdbb10139f7fbb261.zip
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')
-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)
desc->no_suspend_depth--;
}
-static void suspend_device_irq(struct irq_desc *desc, int irq)
+static bool suspend_device_irq(struct irq_desc *desc, int irq)
{
if (!desc->action || desc->no_suspend_depth)
- return;
+ return false;
desc->istate |= IRQS_SUSPENDED;
__disable_irq(desc, irq);
@@ -65,6 +65,7 @@ static void suspend_device_irq(struct irq_desc *desc, int irq)
*/
if (irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
mask_irq(desc);
+ return true;
}
/**
@@ -86,15 +87,15 @@ void suspend_device_irqs(void)
for_each_irq_desc(irq, desc) {
unsigned long flags;
+ bool sync;
raw_spin_lock_irqsave(&desc->lock, flags);
- suspend_device_irq(desc, irq);
+ sync = suspend_device_irq(desc, irq);
raw_spin_unlock_irqrestore(&desc->lock, flags);
- }
- for_each_irq_desc(irq, desc)
- if (desc->istate & IRQS_SUSPENDED)
+ if (sync)
synchronize_irq(irq);
+ }
}
EXPORT_SYMBOL_GPL(suspend_device_irqs);