Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71122
b: refs/heads/master
c: 9cd9a00
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Oct 18, 2007
1 parent c77e653 commit 838c9eb
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c7e0831d385d620a58d95b25e4afa9b643f9a411
refs/heads/master: 9cd9a0058dd35268b24fa16795a92c800f4086d4
63 changes: 46 additions & 17 deletions trunk/kernel/power/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,50 @@ int hibernation_platform_enter(void)
{
int error;

if (hibernation_ops) {
kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
/*
* We have cancelled the power transition by running
* hibernation_ops->finish() before saving the image, so we
* should let the firmware know that we're going to enter the
* sleep state after all
*/
error = hibernation_ops->prepare();
sysdev_shutdown();
if (!error)
error = hibernation_ops->enter();
} else {
error = -ENOSYS;
if (!hibernation_ops)
return -ENOSYS;

/*
* We have cancelled the power transition by running
* hibernation_ops->finish() before saving the image, so we should let
* the firmware know that we're going to enter the sleep state after all
*/
error = hibernation_ops->start();
if (error)
return error;

suspend_console();
error = device_suspend(PMSG_SUSPEND);
if (error)
goto Resume_console;

error = hibernation_ops->prepare();
if (error)
goto Resume_devices;

error = disable_nonboot_cpus();
if (error)
goto Finish;

local_irq_disable();
error = device_power_down(PMSG_SUSPEND);
if (!error) {
hibernation_ops->enter();
/* We should never get here */
while (1);
}
local_irq_enable();

/*
* We don't need to reenable the nonboot CPUs or resume consoles, since
* the system is going to be halted anyway.
*/
Finish:
hibernation_ops->finish();
Resume_devices:
device_resume();
Resume_console:
resume_console();
return error;
}

Expand All @@ -309,14 +338,14 @@ static void power_down(void)
case HIBERNATION_TEST:
case HIBERNATION_TESTPROC:
break;
case HIBERNATION_SHUTDOWN:
kernel_power_off();
break;
case HIBERNATION_REBOOT:
kernel_restart(NULL);
break;
case HIBERNATION_PLATFORM:
hibernation_platform_enter();
case HIBERNATION_SHUTDOWN:
kernel_power_off();
break;
}
kernel_halt();
/*
Expand Down

0 comments on commit 838c9eb

Please sign in to comment.