Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int create_image(int platform_mode)
- {
- int error;
- error = dpm_suspend_end(PMSG_FREEZE);
- if (error) {
- pr_err("Some devices failed to power down, aborting hibernation\n");
- return error;
- }
- error = platform_pre_snapshot(platform_mode);
- if (!(error || hibernation_test(TEST_PLATFORM))) {
- error = disable_nonboot_cpus();
- if (!(error || hibernation_test(TEST_CPUS))) {
- local_irq_disable();
- error = syscore_suspend();
- if (error) {
- pr_err("Some system devices failed to power down, aborting hibernation\n");
- } else {
- if (!(hibernation_test(TEST_CORE) || pm_wakeup_pending())) {
- in_suspend = 1;
- save_processor_state();
- trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, true);
- error = swsusp_arch_suspend();
- /* Restore control flow magically appears here */
- restore_processor_state();
- trace_suspend_resume(TPS("machine_suspend"), PM_EVENT_HIBERNATE, false);
- if (error)
- pr_err("Error %d creating hibernation image\n", error);
- if (!in_suspend) {
- events_check_enabled = false;
- clear_free_pages();
- }
- platform_leave(platform_mode);
- }
- syscore_resume();
- }
- local_irq_enable();
- }
- enable_nonboot_cpus();
- }
- platform_finish(platform_mode);
- dpm_resume_start(in_suspend ?
- (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
- return error;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement