diff options
author | julian <julian@FreeBSD.org> | 2007-11-14 05:43:55 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 2007-11-14 05:43:55 +0000 |
commit | 760b9605ef7227e5fd9997437caddc0a708753b9 (patch) | |
tree | d3ccd8ab6082d9786b177544c5cda4a467c013ac /sys | |
parent | 797a1fb530d34c31f12117fb8d185d501d06b325 (diff) | |
download | FreeBSD-src-760b9605ef7227e5fd9997437caddc0a708753b9.zip FreeBSD-src-760b9605ef7227e5fd9997437caddc0a708753b9.tar.gz |
Apply the same sort of locking done in
sys/dev/acpica/acpi.c rev 1.196 a while ago:
Grab Giant around calls to DEVICE_SUSPEND/RESUME in
acpi_SetSleepState().
If we are resuming non-MPSAFE drivers, they need Giant held for them.
This may fix some obscure suspend/resume problems. It has fixed keyrate
setting problems that were triggered by cardbus (MPSAFE) changing the
ordering for syscons resume (non-MPSAFE). Also, add some asserts that
Giant is held in our suspend/resume and shutdown methods.
Submitted by: Marko Zec
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/bios/apm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 30a24b5..894d135 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -485,7 +485,13 @@ apm_do_suspend(void) apm_op_inprog = 0; sc->suspends = sc->suspend_countdown = 0; + /* + * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since + * non-MPSAFE drivers need this. + */ + mtx_lock(&Giant); error = DEVICE_SUSPEND(root_bus); + mtx_unlock(&Giant); if (error) return; @@ -496,7 +502,9 @@ apm_do_suspend(void) } else { /* Failure, 'resume' the system again */ apm_execute_hook(hook[APM_HOOK_RESUME]); + mtx_lock(&Giant); DEVICE_RESUME(root_bus); + mtx_unlock(&Giant); } return; } @@ -602,7 +610,9 @@ apm_resume(void) sc->suspending = 0; apm_execute_hook(hook[APM_HOOK_RESUME]); + mtx_lock(&Giant); DEVICE_RESUME(root_bus); + mtx_unlock(&Giant); return; } |