summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-05-17 03:43:04 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-05-17 03:43:04 +0000
commitfe20f8344a8978179ffb6791db70b191919ba2a8 (patch)
treee80a0d4c7f1806502d0ade1c7ace784f6e004394 /sys/kern
parenta807f14a489dbde079bbf3334b1fc6935ef23a3f (diff)
Detach children devices in reverse order. This gives better display, and
allows cf_unit to be decremented correctly. 'put it in' deraadt@ "i think it's good' tedu@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_autoconf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 8b05039bf50..f4d98814050 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.44 2006/05/14 14:07:20 krw Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.45 2006/05/17 03:43:03 krw Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -732,14 +732,17 @@ config_detach_children(struct device *parent, int flags)
* we are about to detach, so it would disappear.
* Just play it safe and restart from the parent.
*/
- for (prev_dev = NULL, dev = TAILQ_FIRST(&alldevs);
+ for (prev_dev = NULL, dev = TAILQ_LAST(&alldevs, devicelist);
dev != NULL; dev = next_dev) {
if (dev->dv_parent == parent) {
if ((rv = config_detach(dev, flags)) != 0)
return (rv);
- next_dev = prev_dev ? prev_dev : TAILQ_FIRST(&alldevs);
- } else
- next_dev = TAILQ_NEXT(prev_dev = dev, dv_list);
+ next_dev = prev_dev ? prev_dev : TAILQ_LAST(&alldevs,
+ devicelist);
+ } else {
+ prev_dev = dev;
+ next_dev = TAILQ_PREV(dev, devicelist, dv_list);
+ }
}
return (0);