diff options
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r-- | include/linux/suspend.h | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 57a692432f8a..95040cc33107 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/pm.h> | 7 | #include <linux/pm.h> |
8 | #include <linux/mm.h> | 8 | #include <linux/mm.h> |
9 | #include <linux/freezer.h> | ||
9 | #include <asm/errno.h> | 10 | #include <asm/errno.h> |
10 | 11 | ||
11 | #ifdef CONFIG_VT | 12 | #ifdef CONFIG_VT |
@@ -331,6 +332,8 @@ static inline bool system_entering_hibernation(void) { return false; } | |||
331 | #define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ | 332 | #define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */ |
332 | #define PM_POST_RESTORE 0x0006 /* Restore failed */ | 333 | #define PM_POST_RESTORE 0x0006 /* Restore failed */ |
333 | 334 | ||
335 | extern struct mutex pm_mutex; | ||
336 | |||
334 | #ifdef CONFIG_PM_SLEEP | 337 | #ifdef CONFIG_PM_SLEEP |
335 | void save_processor_state(void); | 338 | void save_processor_state(void); |
336 | void restore_processor_state(void); | 339 | void restore_processor_state(void); |
@@ -351,6 +354,19 @@ extern bool events_check_enabled; | |||
351 | extern bool pm_wakeup_pending(void); | 354 | extern bool pm_wakeup_pending(void); |
352 | extern bool pm_get_wakeup_count(unsigned int *count); | 355 | extern bool pm_get_wakeup_count(unsigned int *count); |
353 | extern bool pm_save_wakeup_count(unsigned int count); | 356 | extern bool pm_save_wakeup_count(unsigned int count); |
357 | |||
358 | static inline void lock_system_sleep(void) | ||
359 | { | ||
360 | freezer_do_not_count(); | ||
361 | mutex_lock(&pm_mutex); | ||
362 | } | ||
363 | |||
364 | static inline void unlock_system_sleep(void) | ||
365 | { | ||
366 | mutex_unlock(&pm_mutex); | ||
367 | freezer_count(); | ||
368 | } | ||
369 | |||
354 | #else /* !CONFIG_PM_SLEEP */ | 370 | #else /* !CONFIG_PM_SLEEP */ |
355 | 371 | ||
356 | static inline int register_pm_notifier(struct notifier_block *nb) | 372 | static inline int register_pm_notifier(struct notifier_block *nb) |
@@ -366,28 +382,11 @@ static inline int unregister_pm_notifier(struct notifier_block *nb) | |||
366 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) | 382 | #define pm_notifier(fn, pri) do { (void)(fn); } while (0) |
367 | 383 | ||
368 | static inline bool pm_wakeup_pending(void) { return false; } | 384 | static inline bool pm_wakeup_pending(void) { return false; } |
369 | #endif /* !CONFIG_PM_SLEEP */ | ||
370 | |||
371 | extern struct mutex pm_mutex; | ||
372 | 385 | ||
373 | #ifndef CONFIG_HIBERNATE_CALLBACKS | ||
374 | static inline void lock_system_sleep(void) {} | 386 | static inline void lock_system_sleep(void) {} |
375 | static inline void unlock_system_sleep(void) {} | 387 | static inline void unlock_system_sleep(void) {} |
376 | 388 | ||
377 | #else | 389 | #endif /* !CONFIG_PM_SLEEP */ |
378 | |||
379 | /* Let some subsystems like memory hotadd exclude hibernation */ | ||
380 | |||
381 | static inline void lock_system_sleep(void) | ||
382 | { | ||
383 | mutex_lock(&pm_mutex); | ||
384 | } | ||
385 | |||
386 | static inline void unlock_system_sleep(void) | ||
387 | { | ||
388 | mutex_unlock(&pm_mutex); | ||
389 | } | ||
390 | #endif | ||
391 | 390 | ||
392 | #ifdef CONFIG_ARCH_SAVE_PAGE_KEYS | 391 | #ifdef CONFIG_ARCH_SAVE_PAGE_KEYS |
393 | /* | 392 | /* |