aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2008-05-20 17:00:01 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-06-10 13:59:50 -0400
commit1eede070a59e1cc73da51e1aaa00d9ab86572cfc (patch)
treeeafccca4f2a1ae2e8ebb06d2dff9528d5a289da4 /arch
parentbb71ad880204b79d60331d3384103976e086cb9f (diff)
Introduce new top level suspend and hibernation callbacks
Introduce 'struct pm_ops' and 'struct pm_ext_ops' ('ext' meaning 'extended') representing suspend and hibernation operations for bus types, device classes, device types and device drivers. Modify the PM core to use 'struct pm_ops' and 'struct pm_ext_ops' objects, if defined, instead of the ->suspend(), ->resume(), ->suspend_late(), and ->resume_early() callbacks (the old callbacks will be considered as legacy and gradually phased out). The main purpose of doing this is to separate suspend (aka S2RAM and standby) callbacks from hibernation callbacks in such a way that the new callbacks won't take arguments and the semantics of each of them will be clearly specified. This has been requested for multiple times by many people, including Linus himself, and the reason is that within the current scheme if ->resume() is called, for example, it's difficult to say why it's been called (ie. is it a resume from RAM or from hibernation or a suspend/hibernation failure etc.?). The second purpose is to make the suspend/hibernation callbacks more flexible so that device drivers can handle more than they can within the current scheme. For example, some drivers may need to prevent new children of the device from being registered before their ->suspend() callbacks are executed or they may want to carry out some operations requiring the availability of some other devices, not directly bound via the parent-child relationship, in order to prepare for the execution of ->suspend(), etc. Ultimately, we'd like to stop using the freezing of tasks for suspend and therefore the drivers' suspend/hibernation code will have to take care of the handling of the user space during suspend/hibernation. That, in turn, would be difficult within the current scheme, without the new ->prepare() and ->complete() callbacks. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/apm_32.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index bf9290e29013..c1735f61a2c0 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -1211,9 +1211,9 @@ static int suspend(int vetoable)
1211 if (err != APM_SUCCESS) 1211 if (err != APM_SUCCESS)
1212 apm_error("suspend", err); 1212 apm_error("suspend", err);
1213 err = (err == APM_SUCCESS) ? 0 : -EIO; 1213 err = (err == APM_SUCCESS) ? 0 : -EIO;
1214 device_power_up(); 1214 device_power_up(PMSG_RESUME);
1215 local_irq_enable(); 1215 local_irq_enable();
1216 device_resume(); 1216 device_resume(PMSG_RESUME);
1217 queue_event(APM_NORMAL_RESUME, NULL); 1217 queue_event(APM_NORMAL_RESUME, NULL);
1218 spin_lock(&user_list_lock); 1218 spin_lock(&user_list_lock);
1219 for (as = user_list; as != NULL; as = as->next) { 1219 for (as = user_list; as != NULL; as = as->next) {
@@ -1238,7 +1238,7 @@ static void standby(void)
1238 apm_error("standby", err); 1238 apm_error("standby", err);
1239 1239
1240 local_irq_disable(); 1240 local_irq_disable();
1241 device_power_up(); 1241 device_power_up(PMSG_RESUME);
1242 local_irq_enable(); 1242 local_irq_enable();
1243} 1243}
1244 1244
@@ -1324,7 +1324,7 @@ static void check_events(void)
1324 ignore_bounce = 1; 1324 ignore_bounce = 1;
1325 if ((event != APM_NORMAL_RESUME) 1325 if ((event != APM_NORMAL_RESUME)
1326 || (ignore_normal_resume == 0)) { 1326 || (ignore_normal_resume == 0)) {
1327 device_resume(); 1327 device_resume(PMSG_RESUME);
1328 queue_event(event, NULL); 1328 queue_event(event, NULL);
1329 } 1329 }
1330 ignore_normal_resume = 0; 1330 ignore_normal_resume = 0;