summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpi/acpi.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2014-03-13 03:52:55 +0000
committerdlg <dlg@openbsd.org>2014-03-13 03:52:55 +0000
commitc3f3b0fe7f6addfa8f7e3716b02787ffc9c4c836 (patch)
tree21358d6ebade683f83a8a73c16f934edb8a47eb8 /sys/dev/acpi/acpi.c
parentDrop the REPUN bit from CvmCtl register not to allow unaligned access. (diff)
downloadwireguard-openbsd-c3f3b0fe7f6addfa8f7e3716b02787ffc9c4c836.tar.xz
wireguard-openbsd-c3f3b0fe7f6addfa8f7e3716b02787ffc9c4c836.zip
get rid of the assumption that the head of the alldevs list is the
"mainbus" device. this breaks when mpath is enabled because it attaches before mainbus and therefore takes the head position. have autoconf provide device_mainbus() which looks up mainbus_cd, and use that instead. discussed with deraadt who just wants mpath stuff to move forward despite there being many ways to shine this particular turd.
Diffstat (limited to 'sys/dev/acpi/acpi.c')
-rw-r--r--sys/dev/acpi/acpi.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 8c9f6064c7a..be06c51ea35 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.253 2014/02/21 23:48:38 deraadt Exp $ */
+/* $OpenBSD: acpi.c,v 1.254 2014/03/13 03:52:56 dlg Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2098,6 +2098,7 @@ acpi_indicator(struct acpi_softc *sc, int led_state)
int
acpi_sleep_state(struct acpi_softc *sc, int state)
{
+ struct device *mainbus = device_mainbus();
int error = ENXIO;
int s;
@@ -2127,7 +2128,7 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
#endif /* NWSDISPLAY > 0 */
bufq_quiesce();
- if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_QUIESCE))
+ if (config_suspend(mainbus, DVACT_QUIESCE))
goto fail_quiesce;
#ifdef MULTIPROCESSOR
@@ -2140,7 +2141,7 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
disable_intr(); /* PSL_I for resume; PIC/APIC broken until repair */
cold = 1; /* Force other code to delay() instead of tsleep() */
- if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND) != 0)
+ if (config_suspend(mainbus, DVACT_SUSPEND) != 0)
goto fail_suspend;
acpi_sleep_clocks(sc, state);
@@ -2172,7 +2173,7 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
acpi_resume_cpu(sc);
fail_pts:
- config_suspend(TAILQ_FIRST(&alldevs), DVACT_RESUME);
+ config_suspend(mainbus, DVACT_RESUME);
fail_suspend:
cold = 0;
@@ -2192,7 +2193,7 @@ fail_suspend:
fail_quiesce:
bufq_restart();
- config_suspend(TAILQ_FIRST(&alldevs), DVACT_WAKEUP);
+ config_suspend(mainbus, DVACT_WAKEUP);
#if NWSDISPLAY > 0
wsdisplay_resume();