diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index f55a0048e4b..b25f4348533 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2727,8 +2727,12 @@ acpi_ReqSleepState(struct acpi_softc *sc, int state) /* S5 (soft-off) should be entered directly with no waiting. */ if (state == ACPI_STATE_S5) { + sc->acpi_sleep_disabled = TRUE; ACPI_UNLOCK(acpi); status = acpi_EnterSleepState(sc, state); + if (ACPI_FAILURE(status)) + sc->acpi_sleep_disabled = FALSE; + return (ACPI_SUCCESS(status) ? 0 : ENXIO); } @@ -2851,18 +2855,15 @@ acpi_sleep_enable(void *arg) static ACPI_STATUS acpi_sleep_disable(struct acpi_softc *sc) { - ACPI_STATUS status; - /* Fail if the system is not fully up and running. */ if (!AcpiGbl_SystemAwakeAndRunning) return (AE_ERROR); ACPI_LOCK(acpi); - status = sc->acpi_sleep_disabled ? AE_ERROR : AE_OK; sc->acpi_sleep_disabled = TRUE; ACPI_UNLOCK(acpi); - return (status); + return (AE_OK); } enum acpi_sleep_state {