diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/disk.c | 10 | ||||
-rw-r--r-- | kernel/power/main.c | 26 |
2 files changed, 23 insertions, 13 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 45e8541ab7e3..432ee575c9ee 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -71,6 +71,14 @@ void hibernation_set_ops(struct platform_hibernation_ops *ops) | |||
71 | mutex_unlock(&pm_mutex); | 71 | mutex_unlock(&pm_mutex); |
72 | } | 72 | } |
73 | 73 | ||
74 | static bool entering_platform_hibernation; | ||
75 | |||
76 | bool system_entering_hibernation(void) | ||
77 | { | ||
78 | return entering_platform_hibernation; | ||
79 | } | ||
80 | EXPORT_SYMBOL(system_entering_hibernation); | ||
81 | |||
74 | #ifdef CONFIG_PM_DEBUG | 82 | #ifdef CONFIG_PM_DEBUG |
75 | static void hibernation_debug_sleep(void) | 83 | static void hibernation_debug_sleep(void) |
76 | { | 84 | { |
@@ -411,6 +419,7 @@ int hibernation_platform_enter(void) | |||
411 | if (error) | 419 | if (error) |
412 | goto Close; | 420 | goto Close; |
413 | 421 | ||
422 | entering_platform_hibernation = true; | ||
414 | suspend_console(); | 423 | suspend_console(); |
415 | error = device_suspend(PMSG_HIBERNATE); | 424 | error = device_suspend(PMSG_HIBERNATE); |
416 | if (error) { | 425 | if (error) { |
@@ -445,6 +454,7 @@ int hibernation_platform_enter(void) | |||
445 | Finish: | 454 | Finish: |
446 | hibernation_ops->finish(); | 455 | hibernation_ops->finish(); |
447 | Resume_devices: | 456 | Resume_devices: |
457 | entering_platform_hibernation = false; | ||
448 | device_resume(PMSG_RESTORE); | 458 | device_resume(PMSG_RESTORE); |
449 | resume_console(); | 459 | resume_console(); |
450 | Close: | 460 | Close: |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 239988873971..b4d219016b6c 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -57,16 +57,6 @@ int pm_notifier_call_chain(unsigned long val) | |||
57 | #ifdef CONFIG_PM_DEBUG | 57 | #ifdef CONFIG_PM_DEBUG |
58 | int pm_test_level = TEST_NONE; | 58 | int pm_test_level = TEST_NONE; |
59 | 59 | ||
60 | static int suspend_test(int level) | ||
61 | { | ||
62 | if (pm_test_level == level) { | ||
63 | printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n"); | ||
64 | mdelay(5000); | ||
65 | return 1; | ||
66 | } | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static const char * const pm_tests[__TEST_AFTER_LAST] = { | 60 | static const char * const pm_tests[__TEST_AFTER_LAST] = { |
71 | [TEST_NONE] = "none", | 61 | [TEST_NONE] = "none", |
72 | [TEST_CORE] = "core", | 62 | [TEST_CORE] = "core", |
@@ -125,14 +115,24 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
125 | } | 115 | } |
126 | 116 | ||
127 | power_attr(pm_test); | 117 | power_attr(pm_test); |
128 | #else /* !CONFIG_PM_DEBUG */ | 118 | #endif /* CONFIG_PM_DEBUG */ |
129 | static inline int suspend_test(int level) { return 0; } | ||
130 | #endif /* !CONFIG_PM_DEBUG */ | ||
131 | 119 | ||
132 | #endif /* CONFIG_PM_SLEEP */ | 120 | #endif /* CONFIG_PM_SLEEP */ |
133 | 121 | ||
134 | #ifdef CONFIG_SUSPEND | 122 | #ifdef CONFIG_SUSPEND |
135 | 123 | ||
124 | static int suspend_test(int level) | ||
125 | { | ||
126 | #ifdef CONFIG_PM_DEBUG | ||
127 | if (pm_test_level == level) { | ||
128 | printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n"); | ||
129 | mdelay(5000); | ||
130 | return 1; | ||
131 | } | ||
132 | #endif /* !CONFIG_PM_DEBUG */ | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | #ifdef CONFIG_PM_TEST_SUSPEND | 136 | #ifdef CONFIG_PM_TEST_SUSPEND |
137 | 137 | ||
138 | /* | 138 | /* |