aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-01-07 18:04:17 -0500
committerLen Brown <len.brown@intel.com>2008-02-01 18:30:56 -0500
commitc697eecebc6cfc0b393afea3c4ff1a5041526ad1 (patch)
tree36b0cb4e667792212c2b5d05ac212662555d1682 /kernel/power/main.c
parent7671b8ae5381a504d4c4ef8dd9c47128c2c3fd7e (diff)
Suspend: Introduce begin() and end() callbacks
On ACPI systems the target state set by acpi_pm_set_target() is reset by acpi_pm_finish(), but that need not be called if the suspend fails.  All platforms that use the .set_target() global suspend callback are affected by analogous issues. For this reason, we need an additional global suspend callback that will reset the target state regardless of whether or not the suspend is successful.  Also, it is reasonable to rename the .set_target() callback, since it will be used for a different purpose on ACPI systems (due to ACPI 1.0x code ordering requirements). Introduce the global suspend callback .end() to be executed at the end of the suspend sequence and rename the .set_target() global suspend callback to .begin(). Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 050a6077ea45..d9bba452764b 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -258,10 +258,10 @@ int suspend_devices_and_enter(suspend_state_t state)
258 if (!suspend_ops) 258 if (!suspend_ops)
259 return -ENOSYS; 259 return -ENOSYS;
260 260
261 if (suspend_ops->set_target) { 261 if (suspend_ops->begin) {
262 error = suspend_ops->set_target(state); 262 error = suspend_ops->begin(state);
263 if (error) 263 if (error)
264 return error; 264 goto Close;
265 } 265 }
266 suspend_console(); 266 suspend_console();
267 error = device_suspend(PMSG_SUSPEND); 267 error = device_suspend(PMSG_SUSPEND);
@@ -294,6 +294,9 @@ int suspend_devices_and_enter(suspend_state_t state)
294 device_resume(); 294 device_resume();
295 Resume_console: 295 Resume_console:
296 resume_console(); 296 resume_console();
297 Close:
298 if (suspend_ops->end)
299 suspend_ops->end();
297 return error; 300 return error;
298} 301}
299 302