1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-11 14:10:34 +00:00

Fix the problem acpi_sleep_force() hang.

Suspending from callout cause the freeze in DEVICE_SUSPEND().
Suspend from acpi_task thread in stead.

MFC after:	3 days
This commit is contained in:
Mitsuru IWASAKI 2012-05-29 05:09:40 +00:00
parent c414207ab0
commit ffe3f1f8cc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236220

View File

@ -2448,6 +2448,16 @@ acpi_SetSleepState(struct acpi_softc *sc, int state)
}
#if defined(__amd64__) || defined(__i386__)
static void
acpi_sleep_force_task(void *context)
{
struct acpi_softc *sc = (struct acpi_softc *)context;
if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate)))
device_printf(sc->acpi_dev, "force sleep state S%d failed\n",
sc->acpi_next_sstate);
}
static void
acpi_sleep_force(void *arg)
{
@ -2455,9 +2465,13 @@ acpi_sleep_force(void *arg)
device_printf(sc->acpi_dev,
"suspend request timed out, forcing sleep now\n");
if (ACPI_FAILURE(acpi_EnterSleepState(sc, sc->acpi_next_sstate)))
device_printf(sc->acpi_dev, "force sleep state S%d failed\n",
sc->acpi_next_sstate);
/*
* XXX Suspending from callout cause the freeze in DEVICE_SUSPEND().
* Suspend from acpi_task thread in stead.
*/
if (ACPI_FAILURE(AcpiOsExecute(OSL_NOTIFY_HANDLER,
acpi_sleep_force_task, sc)))
device_printf(sc->acpi_dev, "AcpiOsExecute() for sleeping failed\n");
}
#endif