Hibernation: Prepare to enter the low power state
Subsystems (3)
RFC PATCH 1/1 Hibernation: Prepare to enter the low power state
From: Rafael J. Wysocki <[email protected]>
During hibernation we call hibernation_ops->prepare() before creating the image, but then we cancel the power transition by calling hibernation_ops->finish() before saving it. 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.
--- kernel/power/disk.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
kernel/power/disk.c +15 -3
@@ -205,12 +205,24 @@ int hibernation_restore(int platform_modint 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) { +kernel_shutdown_prepare (SYSTEM_SUSPEND_DISK ); + error = hibernation_ops->enter (); + } }else { -return -ENOSYS ; + error = -ENOSYS ; } +return error; }/**
RFC PATCH 1/1 Hibernation: Prepare to enter the low power state (updated)
Sorry, the code ordering was wrong in the previous version.
---
From: Rafael J. Wysocki <[email protected]>
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.
--- kernel/power/disk.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
kernel/power/disk.c +13 -2
@@ -205,12 +205,23 @@ int hibernation_restore(int platform_modint 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; }/**
RFC PATCH 1/1 Hibernation: Prepare to enter the low power state (updated)
In reply to Rafael J. WysockiSorry, the code ordering was wrong in the previous version.
---
From: Rafael J. Wysocki <[email protected]>
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.
--- kernel/power/disk.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
kernel/power/disk.c +13 -2
@@ -205,12 +205,23 @@ int hibernation_restore(int platform_modint 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; }/**