Skip to content

Commit

Permalink
Hibernation: prepare to enter the low power state
Browse files Browse the repository at this point in the history
During hibernation we call hibernation_ops->prepare() before creating the image,
but then, before saving it, we cancel the power transition by calling
hibernation_ops->finish().  Thus prior to calling hibernation_ops->enter() we
should let the platform firmware know that we're going to enter the low power
state after all.

Signed-off-by: Rafael J. Wysocki <[email protected]>
Cc: Gautham R Shenoy <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Nigel Cunningham <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
rjwysocki authored and Linus Torvalds committed Jul 19, 2007
1 parent 10a1803 commit b1457bc
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions kernel/power/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,23 @@ int hibernation_restore(int platform_mode)

int hibernation_platform_enter(void)
{
int error;

if (hibernation_ops) {
kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
return hibernation_ops->enter();
/*
* 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();
if (!error)
error = hibernation_ops->enter();
} else {
return -ENOSYS;
error = -ENOSYS;
}
return error;
}

/**
Expand Down

0 comments on commit b1457bc

Please sign in to comment.