summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-09-23 18:33:35 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-09-23 18:33:35 +0000
commit47c0703d84c19a097b404ea757b2777d767b8f66 (patch)
tree1d1d6c8c09631c623be6cfb5d78c40246ecfee9c /sys/dev/acpi/acpi.c
parent2a98a6a4912a5fa84a444f03f9056dbc0651e9e8 (diff)
Release the acpi lock around calls to wsdisplay_suspend() and
wsdisplay_resume(). The X server may adjust the display brightness just before/after the VT switch when suspending/resuming. In fact, it may already be blocked adjusting the display brightness for some reason unrelated to the suspend request. The VT switch request will eventually time out, but the delay is annoying and the failed VT switch will lead to problems after resume. Needed for a future update of the xf86-video-intel driver. ok mlarkin@
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 5bf1fb3222c..0c67985e753 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.269 2014/09/19 20:02:25 kettenis Exp $ */
+/* $OpenBSD: acpi.c,v 1.270 2014/09/23 18:33:34 kettenis Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2135,7 +2135,13 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
acpi_indicator(sc, ACPI_SST_WAKING); /* blink */
#if NWSDISPLAY > 0
+ /*
+ * Temporarily release the lock to prevent the X server from
+ * blocking on setting the display brightness.
+ */
+ rw_exit_write(&sc->sc_lck);
wsdisplay_suspend();
+ rw_enter_write(&sc->sc_lck);
#endif /* NWSDISPLAY > 0 */
if (config_suspend_all(DVACT_QUIESCE))
@@ -2222,7 +2228,9 @@ fail_quiesce:
config_suspend_all(DVACT_WAKEUP);
#if NWSDISPLAY > 0
+ rw_exit_write(&sc->sc_lck);
wsdisplay_resume();
+ rw_enter_write(&sc->sc_lck);
#endif /* NWSDISPLAY > 0 */
acpi_record_event(sc, APM_NORMAL_RESUME);