svn commit: r235835 - stable/9/sys/dev/acpica

Mitsuru IWASAKI iwasaki at FreeBSD.org
Wed May 23 14:44:58 UTC 2012


Author: iwasaki
Date: Wed May 23 14:44:57 2012
New Revision: 235835
URL: http://svn.freebsd.org/changeset/base/235835

Log:
  MFC 235692,235772:
  - Don't start the sleep state transition procedure while sleep is
    disabled or the system is in shutdown procedure.
  - Ignore the power button press event for resuming rather than starting
    shutdown.

Modified:
  stable/9/sys/dev/acpica/acpi.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi.c
==============================================================================
--- stable/9/sys/dev/acpica/acpi.c	Wed May 23 13:45:52 2012	(r235834)
+++ stable/9/sys/dev/acpica/acpi.c	Wed May 23 14:44:57 2012	(r235835)
@@ -2468,14 +2468,20 @@ acpi_ReqSleepState(struct acpi_softc *sc
     if (!acpi_sleep_states[state])
 	return (EOPNOTSUPP);
 
-    ACPI_LOCK(acpi);
-
     /* If a suspend request is already in progress, just return. */
     if (sc->acpi_next_sstate != 0) {
-    	ACPI_UNLOCK(acpi);
 	return (0);
     }
 
+    /* Wait until sleep is enabled. */
+    while (sc->acpi_sleep_disabled) {
+	AcpiOsSleep(1000);
+    }
+
+    ACPI_LOCK(acpi);
+
+    sc->acpi_next_sstate = state;
+
     /* S5 (soft-off) should be entered directly with no waiting. */
     if (state == ACPI_STATE_S5) {
     	ACPI_UNLOCK(acpi);
@@ -2484,7 +2490,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) {


More information about the svn-src-stable-9 mailing list