mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Correctly handle suspend and resume in APM.
Up to now, errors from DEVICE_SUSPEND(root_bus) were ignored. The fix for this problem (the introduction of defaults for device methods) has been committed months ago by Doug Rabson. Second, the suspended devices were not always properly resumed on error. Third, swapped the order for calling restore hooks and restore methods, to be in line with the cases above. Reviewed by: Doug Rabson Approved by: jhk
This commit is contained in:
parent
ef4da90333
commit
16422b76f1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57010
@ -473,19 +473,18 @@ apm_do_suspend(void)
|
||||
|
||||
if (sc->initialized) {
|
||||
error = DEVICE_SUSPEND(root_bus);
|
||||
/*
|
||||
* XXX Shouldn't ignore the error like this, but should
|
||||
* instead fix the newbus code. Until that happens,
|
||||
* I'm doing this to get suspend working again.
|
||||
*/
|
||||
if (error)
|
||||
printf("DEVICE_SUSPEND error %d, ignored\n", error);
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(PMST_SUSPEND) == 0)
|
||||
apm_processevent();
|
||||
else
|
||||
/* Failure, 'resume' the system again */
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
if (error) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
} else {
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(PMST_SUSPEND) == 0) {
|
||||
apm_processevent();
|
||||
} else {
|
||||
/* Failure, 'resume' the system again */
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
DEVICE_RESUME(root_bus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,8 +592,8 @@ apm_resume(void)
|
||||
return;
|
||||
|
||||
if (sc->initialized) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
DEVICE_RESUME(root_bus);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,19 +473,18 @@ apm_do_suspend(void)
|
||||
|
||||
if (sc->initialized) {
|
||||
error = DEVICE_SUSPEND(root_bus);
|
||||
/*
|
||||
* XXX Shouldn't ignore the error like this, but should
|
||||
* instead fix the newbus code. Until that happens,
|
||||
* I'm doing this to get suspend working again.
|
||||
*/
|
||||
if (error)
|
||||
printf("DEVICE_SUSPEND error %d, ignored\n", error);
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(PMST_SUSPEND) == 0)
|
||||
apm_processevent();
|
||||
else
|
||||
/* Failure, 'resume' the system again */
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
if (error) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
} else {
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(PMST_SUSPEND) == 0) {
|
||||
apm_processevent();
|
||||
} else {
|
||||
/* Failure, 'resume' the system again */
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
DEVICE_RESUME(root_bus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,8 +592,8 @@ apm_resume(void)
|
||||
return;
|
||||
|
||||
if (sc->initialized) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
DEVICE_RESUME(root_bus);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user