Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2012 16:36:54 +0000 (UTC)
From:      Mitsuru IWASAKI <iwasaki@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r235692 - head/sys/dev/acpica
Message-ID:  <201205201636.q4KGas5v003682@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205201636.q4KGas5v003682>