summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-03-13 03:52:57 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-03-13 03:52:57 +0000
commitddb81f81c6b53bdfc4bba2ced060724d2beb0270 (patch)
tree84af82316dccb1276e4f2db46dffa3136279a846 /sys/kern
parent755327f10676720e29b6c5b380070fbdca133628 (diff)
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/kern')
-rw-r--r--sys/kern/subr_autoconf.c12
-rw-r--r--sys/kern/subr_hibernate.c6
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 63909888184..390dee9ca8b 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.73 2013/12/12 20:56:01 guenther Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.74 2014/03/13 03:52:56 dlg Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -859,6 +859,16 @@ device_lookup(struct cfdriver *cd, int unit)
return (dv);
}
+struct device *
+device_mainbus(void)
+{
+ extern struct cfdriver mainbus_cd;
+
+ if (mainbus_cd.cd_ndevs < 1)
+ return (NULL);
+
+ return (mainbus_cd.cd_devs[0]);
+}
/*
* Increments the ref count on the device structure. The device
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index 147a3e1803b..4d0efd949c6 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.84 2014/02/01 07:10:33 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.85 2014/03/13 03:52:56 dlg Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -1152,14 +1152,14 @@ hibernate_resume(void)
if (hibernate_read_image(&disk_hib))
goto fail;
- if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_QUIESCE) != 0)
+ if (config_suspend(device_mainbus(), DVACT_QUIESCE) != 0)
goto fail;
(void) splhigh();
hibernate_disable_intr_machdep();
cold = 1;
- if (config_suspend(TAILQ_FIRST(&alldevs), DVACT_SUSPEND) != 0) {
+ if (config_suspend(device_mainbus(), DVACT_SUSPEND) != 0) {
cold = 0;
hibernate_enable_intr_machdep();
goto fail;