summaryrefslogtreecommitdiffstats
path: root/sys/i386/bios/apm.c
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-02-06 14:57:05 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-02-06 14:57:05 +0000
commit61f262d00f5b757548dd48830be95188c4a063d4 (patch)
tree1dedcfc3dfd43507a3e4c01ac3ff361a0fe36643 /sys/i386/bios/apm.c
parentadad9ac78e8ab4fd3b329a4753c97503bea836ea (diff)
downloadFreeBSD-src-61f262d00f5b757548dd48830be95188c4a063d4.zip
FreeBSD-src-61f262d00f5b757548dd48830be95188c4a063d4.tar.gz
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
Diffstat (limited to 'sys/i386/bios/apm.c')
-rw-r--r--sys/i386/bios/apm.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index 246543e..4eb99dd 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -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);
}
}
OpenPOWER on IntegriCloud