summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2010-04-07 17:46:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2010-04-07 17:46:31 +0000
commit1193b810e8339e64b525abb97aeb0c8cbd30cd10 (patch)
tree2a7d7d2b7bf741fa624fa8486f64a5883d19dab1 /sys
parent7757e8fe89201ded301c5f28f12dcb1cca106687 (diff)
If we have done a wsdisplay_suspend(), and ACPI decides it does not want to
suspend, we must roll back by calling wsdisplay_resume() or the virtual console switching will be locked forever ok oga
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/acpi/acpi.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index b66e45732b3..948e265e78d 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.156 2010/04/07 06:33:06 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.157 2010/04/07 17:46:30 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2031,6 +2031,7 @@ int
acpi_prepare_sleep_state(struct acpi_softc *sc, int state)
{
struct aml_value env;
+ int error = 0;
if (sc == NULL || state == ACPI_STATE_S0)
return(0);
@@ -2070,7 +2071,8 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state)
if (state == ACPI_STATE_S3)
if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND) != 0) {
acpi_handle_suspend_failure(sc);
- return (1);
+ error = ENXIO;
+ goto fail;
}
#endif /* ! SMALL_KERNEL */
@@ -2079,7 +2081,8 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state)
if (aml_evalnode(sc, sc->sc_pts, 1, &env, NULL) != 0) {
dnprintf(10, "%s evaluating method _PTS failed.\n",
DEVNAME(sc));
- return (ENXIO);
+ error = ENXIO;
+ goto fail;
}
sc->sc_state = state;
@@ -2088,13 +2091,19 @@ acpi_prepare_sleep_state(struct acpi_softc *sc, int state)
if (aml_evalnode(sc, sc->sc_gts, 1, &env, NULL) != 0) {
dnprintf(10, "%s evaluating method _GTS failed.\n",
DEVNAME(sc));
- return (ENXIO);
+ error = ENXIO;
+ goto fail;
}
/* Enable wake GPEs */
acpi_susp_resume_gpewalk(sc, state, 1);
- return (0);
+fail:
+#if NWSDISPLAY > 0
+ if (error)
+ wsdisplay_resume();
+#endif /* NWSDISPLAY > 0 */
+ return (error);
}