Add event handlers for (ACPI) suspend/resume events. Suspend event handlers

are invoked right before device drivers go into sleep state and resume event
handlers are invoked right after all device drivers are waken up.
This commit is contained in:
Jung-uk Kim 2011-04-14 22:17:39 +00:00
parent 3472288282
commit 4a8fa6fe58
2 changed files with 9 additions and 0 deletions

View File

@ -2594,6 +2594,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
return_ACPI_STATUS (AE_OK);
}
EVENTHANDLER_INVOKE(power_suspend);
if (smp_started) {
thread_lock(curthread);
sched_bind(curthread, 0);
@ -2685,6 +2687,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state)
thread_unlock(curthread);
}
EVENTHANDLER_INVOKE(power_resume);
/* Allow another sleep request after a while. */
timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME);

View File

@ -178,6 +178,11 @@ EVENTHANDLER_DECLARE(shutdown_pre_sync, shutdown_fn); /* before fs sync */
EVENTHANDLER_DECLARE(shutdown_post_sync, shutdown_fn); /* after fs sync */
EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);
/* Power state change events */
typedef void (*power_change_fn)(void *);
EVENTHANDLER_DECLARE(power_resume, power_change_fn);
EVENTHANDLER_DECLARE(power_suspend, power_change_fn);
/* Low memory event */
typedef void (*vm_lowmem_handler_t)(void *, int);
#define LOWMEM_PRI_DEFAULT EVENTHANDLER_PRI_FIRST