summaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-11-19 23:49:18 +0100
committerLen Brown <len.brown@intel.com>2008-02-01 18:30:54 -0500
commit825257569350e913bee3bc918508c0aa6e3398cd (patch)
tree2d016a04dfc09938565d5e932f0d2d5e43fb6bdd /kernel/power/main.c
parent90dda1cb6ace6abd777f84bf051c4f86fa58986a (diff)
downloadop-kernel-dev-825257569350e913bee3bc918508c0aa6e3398cd.zip
op-kernel-dev-825257569350e913bee3bc918508c0aa6e3398cd.tar.gz
PM: Convert PM notifiers to out-of-line code
This patch (as1008b) converts the PM notifier routines from inline calls to out-of-line code. It also prevents pm_chain_head from being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the notifier registration and unregistration routines. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index fc717b8..0a9f269 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -24,13 +24,37 @@
#include "power.h"
-BLOCKING_NOTIFIER_HEAD(pm_chain_head);
-
DEFINE_MUTEX(pm_mutex);
unsigned int pm_flags;
EXPORT_SYMBOL(pm_flags);
+#ifdef CONFIG_PM_SLEEP
+
+/* Routines for PM-transition notifications */
+
+static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
+
+int register_pm_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_register(&pm_chain_head, nb);
+}
+EXPORT_SYMBOL_GPL(register_pm_notifier);
+
+int unregister_pm_notifier(struct notifier_block *nb)
+{
+ return blocking_notifier_chain_unregister(&pm_chain_head, nb);
+}
+EXPORT_SYMBOL_GPL(unregister_pm_notifier);
+
+int pm_notifier_call_chain(unsigned long val)
+{
+ return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
+ == NOTIFY_BAD) ? -EINVAL : 0;
+}
+
+#endif /* CONFIG_PM_SLEEP */
+
#ifdef CONFIG_PM_DEBUG
int pm_test_level = TEST_NONE;
OpenPOWER on IntegriCloud