diff options
author | jhb <jhb@FreeBSD.org> | 2014-09-22 14:27:26 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-09-22 14:27:26 +0000 |
commit | d08fb7f87738c5246eb1e0e0ec10b71a79d855be (patch) | |
tree | af06f24af9103896dd67b86a5c9a2367326e52ac /sys/dev/acpica/acpi.c | |
parent | fe74bc61638e2114cbcda81fc1e045226717fe34 (diff) | |
download | FreeBSD-src-d08fb7f87738c5246eb1e0e0ec10b71a79d855be.zip FreeBSD-src-d08fb7f87738c5246eb1e0e0ec10b71a79d855be.tar.gz |
Convert from timeout(9) to callout(9).
Diffstat (limited to 'sys/dev/acpica/acpi.c')
-rw-r--r-- | sys/dev/acpica/acpi.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 2f30092..1913912 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -93,6 +93,7 @@ struct acpi_interface { /* Global mutex for locking access to the ACPI subsystem. */ struct mtx acpi_mutex; +struct callout acpi_sleep_timer; /* Bitmap of device quirks. */ int acpi_quirks; @@ -683,7 +684,9 @@ acpi_attach(device_t dev) AcpiFormatException(status)); /* Allow sleep request after a while. */ - timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME); + callout_init_mtx(&acpi_sleep_timer, &acpi_mutex, 0); + callout_reset(&acpi_sleep_timer, hz * ACPI_MINIMUM_AWAKETIME, + acpi_sleep_enable, sc); error = 0; @@ -2490,8 +2493,8 @@ acpi_sleep_force(void *arg) device_printf(sc->acpi_dev, "suspend request timed out, forcing sleep now\n"); /* - * XXX Suspending from callout cause the freeze in DEVICE_SUSPEND(). - * Suspend from acpi_task thread in stead. + * XXX Suspending from callout causes freezes in DEVICE_SUSPEND(). + * Suspend from acpi_task thread instead. */ if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_sleep_force_task, sc))) @@ -2643,15 +2646,15 @@ acpi_sleep_enable(void *arg) { struct acpi_softc *sc = (struct acpi_softc *)arg; + ACPI_LOCK_ASSERT(acpi); + /* Reschedule if the system is not fully up and running. */ if (!AcpiGbl_SystemAwakeAndRunning) { - timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME); + callout_schedule(&acpi_sleep_timer, hz * ACPI_MINIMUM_AWAKETIME); return; } - ACPI_LOCK(acpi); sc->acpi_sleep_disabled = FALSE; - ACPI_UNLOCK(acpi); } static ACPI_STATUS @@ -2866,7 +2869,7 @@ backout: EVENTHANDLER_INVOKE(power_resume); /* Allow another sleep request after a while. */ - timeout(acpi_sleep_enable, sc, hz * ACPI_MINIMUM_AWAKETIME); + callout_schedule(&acpi_sleep_timer, hz * ACPI_MINIMUM_AWAKETIME); /* Run /etc/rc.resume after we are back. */ if (devctl_process_running()) |