From 1193b810e8339e64b525abb97aeb0c8cbd30cd10 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 7 Apr 2010 17:46:31 +0000 Subject: 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 --- sys/dev/acpi/acpi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'sys/dev') 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 * Copyright (c) 2005 Jordan Hargrave @@ -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); } -- cgit v1.2.3