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
This commit is contained in:
Julian Elischer 2007-11-14 05:43:55 +00:00
parent df4706e2cc
commit 502e39a873

View File

@ -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;
}