Author: iwasaki
Date: Sun May 20 16:36:54 2012
New Revision: 235692
URL: http://svn.freebsd.org/changeset/base/235692

Log:
  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

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c  Sun May 20 16:09:40 2012        (r235691)
+++ head/sys/dev/acpica/acpi.c  Sun May 20 16:36:54 2012        (r235692)
@@ -2515,6 +2515,11 @@ acpi_ReqSleepState(struct acpi_softc *sc
     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
        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
     }
 
     /* 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) {
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to