diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-17 03:43:04 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-05-17 03:43:04 +0000 |
commit | fe20f8344a8978179ffb6791db70b191919ba2a8 (patch) | |
tree | e80a0d4c7f1806502d0ade1c7ace784f6e004394 /sys/kern/subr_autoconf.c | |
parent | a807f14a489dbde079bbf3334b1fc6935ef23a3f (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/subr_autoconf.c')
-rw-r--r-- | sys/kern/subr_autoconf.c | 13 |
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); |