From owner-svn-src-all@FreeBSD.ORG Sun May 20 16:36:54 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD1CE1065672; Sun, 20 May 2012 16:36:54 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A89AD8FC08; Sun, 20 May 2012 16:36:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4KGasQY003684; Sun, 20 May 2012 16:36:54 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4KGas5v003682; Sun, 20 May 2012 16:36:54 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201205201636.q4KGas5v003682@svn.freebsd.org> From: Mitsuru IWASAKI Date: Sun, 20 May 2012 16:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235692 - head/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 May 2012 16:36:54 -0000 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) {