Add suspend/resume event handlers for apm(4) as well.

This commit is contained in:
Jung-uk Kim 2011-04-19 16:20:55 +00:00
parent 9d0a2ddf69
commit ba40504144

View File

@ -484,16 +484,16 @@ apm_do_suspend(void)
apm_op_inprog = 0;
sc->suspends = sc->suspend_countdown = 0;
EVENTHANDLER_INVOKE(power_suspend);
/*
* Be sure to hold Giant across DEVICE_SUSPEND/RESUME since
* non-MPSAFE drivers need this.
*/
mtx_lock(&Giant);
error = DEVICE_SUSPEND(root_bus);
if (error) {
mtx_unlock(&Giant);
return;
}
if (error)
goto backout;
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
if (apm_suspend_system(PMST_SUSPEND) == 0) {
@ -504,8 +504,9 @@ apm_do_suspend(void)
apm_execute_hook(hook[APM_HOOK_RESUME]);
DEVICE_RESUME(root_bus);
}
backout:
mtx_unlock(&Giant);
return;
EVENTHANDLER_INVOKE(power_resume);
}
static void
@ -612,7 +613,7 @@ apm_resume(void)
mtx_lock(&Giant);
DEVICE_RESUME(root_bus);
mtx_unlock(&Giant);
return;
EVENTHANDLER_INVOKE(power_resume);
}