11 #include <linux/string.h>
13 #include <linux/errno.h>
20 #include <linux/kernel.h>
21 #include <linux/list.h>
23 #include <linux/slab.h>
24 #include <linux/export.h>
47 unlock_system_sleep();
57 return suspend_ops && suspend_ops->
valid && suspend_ops->
valid(state);
73 static int suspend_test(
int level)
75 #ifdef CONFIG_PM_DEBUG
76 if (pm_test_level == level) {
92 static int suspend_prepare(
void)
96 if (!suspend_ops || !suspend_ops->
enter)
105 error = suspend_freeze_processes();
141 error = suspend_ops->
prepare();
143 goto Platform_finish;
149 goto Platform_finish;
161 error = disable_nonboot_cpus();
168 error = syscore_suspend();
171 if (!(suspend_test(
TEST_CORE) || *wakeup)) {
172 error = suspend_ops->
enter(state);
173 events_check_enabled =
false;
182 enable_nonboot_cpus();
185 if (suspend_ops->
wake)
209 trace_machine_suspend(state);
210 if (suspend_ops->
begin) {
211 error = suspend_ops->
begin(state);
221 goto Recover_platform;
225 goto Recover_platform;
228 error = suspend_enter(state, &wakeup);
229 }
while (!error && !wakeup
239 if (suspend_ops->
end)
256 static void suspend_finish(
void)
258 suspend_thaw_processes();
286 error = suspend_prepare();
299 pr_debug(
"PM: Finishing wakeup.\n");
320 error = enter_state(state);
323 dpm_save_failed_errno(error);