aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/suspend.h13
-rw-r--r--kernel/power/main.c28
-rw-r--r--kernel/power/power.h12
3 files changed, 32 insertions, 21 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 40280df2a3db..51283e0745b3 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -213,17 +213,8 @@ void save_processor_state(void);
213void restore_processor_state(void); 213void restore_processor_state(void);
214 214
215/* kernel/power/main.c */ 215/* kernel/power/main.c */
216extern struct blocking_notifier_head pm_chain_head; 216extern int register_pm_notifier(struct notifier_block *nb);
217 217extern int unregister_pm_notifier(struct notifier_block *nb);
218static inline int register_pm_notifier(struct notifier_block *nb)
219{
220 return blocking_notifier_chain_register(&pm_chain_head, nb);
221}
222
223static inline int unregister_pm_notifier(struct notifier_block *nb)
224{
225 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
226}
227 218
228#define pm_notifier(fn, pri) { \ 219#define pm_notifier(fn, pri) { \
229 static struct notifier_block fn##_nb = \ 220 static struct notifier_block fn##_nb = \
diff --git a/kernel/power/main.c b/kernel/power/main.c
index fc717b836828..0a9f269075ee 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -24,13 +24,37 @@
24 24
25#include "power.h" 25#include "power.h"
26 26
27BLOCKING_NOTIFIER_HEAD(pm_chain_head);
28
29DEFINE_MUTEX(pm_mutex); 27DEFINE_MUTEX(pm_mutex);
30 28
31unsigned int pm_flags; 29unsigned int pm_flags;
32EXPORT_SYMBOL(pm_flags); 30EXPORT_SYMBOL(pm_flags);
33 31
32#ifdef CONFIG_PM_SLEEP
33
34/* Routines for PM-transition notifications */
35
36static BLOCKING_NOTIFIER_HEAD(pm_chain_head);
37
38int register_pm_notifier(struct notifier_block *nb)
39{
40 return blocking_notifier_chain_register(&pm_chain_head, nb);
41}
42EXPORT_SYMBOL_GPL(register_pm_notifier);
43
44int unregister_pm_notifier(struct notifier_block *nb)
45{
46 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
47}
48EXPORT_SYMBOL_GPL(unregister_pm_notifier);
49
50int pm_notifier_call_chain(unsigned long val)
51{
52 return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
53 == NOTIFY_BAD) ? -EINVAL : 0;
54}
55
56#endif /* CONFIG_PM_SLEEP */
57
34#ifdef CONFIG_PM_DEBUG 58#ifdef CONFIG_PM_DEBUG
35int pm_test_level = TEST_NONE; 59int pm_test_level = TEST_NONE;
36 60
diff --git a/kernel/power/power.h b/kernel/power/power.h
index f9f0d4d26c50..a9732fd12239 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -172,14 +172,10 @@ static inline int suspend_devices_and_enter(suspend_state_t state)
172} 172}
173#endif /* !CONFIG_SUSPEND */ 173#endif /* !CONFIG_SUSPEND */
174 174
175/* kernel/power/common.c */ 175#ifdef CONFIG_PM_SLEEP
176extern struct blocking_notifier_head pm_chain_head; 176/* kernel/power/main.c */
177 177extern int pm_notifier_call_chain(unsigned long val);
178static inline int pm_notifier_call_chain(unsigned long val) 178#endif
179{
180 return (blocking_notifier_call_chain(&pm_chain_head, val, NULL)
181 == NOTIFY_BAD) ? -EINVAL : 0;
182}
183 179
184#ifdef CONFIG_HIGHMEM 180#ifdef CONFIG_HIGHMEM
185unsigned int count_highmem_pages(void); 181unsigned int count_highmem_pages(void);