summaryrefslogtreecommitdiffstats
path: root/kernel/irq/pm.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-08-28 11:44:31 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-01 13:48:05 +0200
commitcab303be91dc47942bc25de33dc1140123540800 (patch)
treefdfec3ef37665af47af9010419e8f1c2236b0e0f /kernel/irq/pm.c
parent8df2e02c5c4de9e65ee60153dd9c442356534ad9 (diff)
downloadlinux-cab303be91dc47942bc25de33dc1140123540800.tar.gz
linux-cab303be91dc47942bc25de33dc1140123540800.tar.bz2
linux-cab303be91dc47942bc25de33dc1140123540800.zip
genirq: Add sanity checks for PM options on shared interrupt lines
Account the IRQF_NO_SUSPEND and IRQF_RESUME_EARLY actions on shared interrupt lines and yell loudly if there is a mismatch. 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.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index b84141dcee5e..1b1b67a73218 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -13,6 +13,42 @@
#include "internals.h"
+/*
+ * Called from __setup_irq() with desc->lock held after @action has
+ * been installed in the action chain.
+ */
+void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action)
+{
+ desc->nr_actions++;
+
+ if (action->flags & IRQF_FORCE_RESUME)
+ desc->force_resume_depth++;
+
+ WARN_ON_ONCE(desc->force_resume_depth &&
+ desc->force_resume_depth != desc->nr_actions);
+
+ if (action->flags & IRQF_NO_SUSPEND)
+ desc->no_suspend_depth++;
+
+ WARN_ON_ONCE(desc->no_suspend_depth &&
+ desc->no_suspend_depth != desc->nr_actions);
+}
+
+/*
+ * Called from __free_irq() with desc->lock held after @action has
+ * been removed from the action chain.
+ */
+void irq_pm_remove_action(struct irq_desc *desc, struct irqaction *action)
+{
+ desc->nr_actions--;
+
+ if (action->flags & IRQF_FORCE_RESUME)
+ desc->force_resume_depth--;
+
+ if (action->flags & IRQF_NO_SUSPEND)
+ desc->no_suspend_depth--;
+}
+
static void suspend_device_irq(struct irq_desc *desc, int irq)
{
if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))