From f22377a8c7377ab1e4b5410db09f92dda9c62016 Mon Sep 17 00:00:00 2001 From: Mitsuru IWASAKI Date: Sun, 20 May 2012 16:36:54 +0000 Subject: [PATCH] Don't start the sleep state transition procedure while sleep is disabled or the system is in shutdown procedure. This should fix the problem which kernel never response to the sleep button press events after the message `suspend request ignored (not ready yet)'. MFC after: 3 days --- sys/dev/acpica/acpi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index a4038b3fc99f..d96902b204ba 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -2515,6 +2515,11 @@ acpi_ReqSleepState(struct acpi_softc *sc, int state) if (!acpi_sleep_states[state]) return (EOPNOTSUPP); + /* Wait until sleep is enabled. */ + while (sc->acpi_sleep_disabled) { + AcpiOsSleep(1000); + } + ACPI_LOCK(acpi); /* If a suspend request is already in progress, just return. */ @@ -2522,6 +2527,7 @@ acpi_ReqSleepState(struct acpi_softc *sc, int state) ACPI_UNLOCK(acpi); return (0); } + sc->acpi_next_sstate = state; /* S5 (soft-off) should be entered directly with no waiting. */ if (state == ACPI_STATE_S5) { @@ -2531,7 +2537,6 @@ acpi_ReqSleepState(struct acpi_softc *sc, int state) } /* Record the pending state and notify all apm devices. */ - sc->acpi_next_sstate = state; STAILQ_FOREACH(clone, &sc->apm_cdevs, entries) { clone->notify_status = APM_EV_NONE; if ((clone->flags & ACPI_EVF_DEVD) == 0) {