diff options
author | peter <peter@FreeBSD.org> | 2007-11-30 21:30:14 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2007-11-30 21:30:14 +0000 |
commit | e287ae6b7a80814f022c11fbdaf107172bc3add6 (patch) | |
tree | f6aa6a075e66b5cc9940ac188289c5f2e34bdbe1 /sys | |
parent | 8959a77f75e14ee526cde23b54520d20e8cb1a78 (diff) | |
download | FreeBSD-src-e287ae6b7a80814f022c11fbdaf107172bc3add6.zip FreeBSD-src-e287ae6b7a80814f022c11fbdaf107172bc3add6.tar.gz |
Deal with the possibility of device_set_unit() being called when attaching
the associated devinfo sysctl tree.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_bus.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5435a7c..420834a 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -307,6 +307,16 @@ device_sysctl_init(device_t dev) } static void +device_sysctl_update(device_t dev) +{ + devclass_t dc = dev->devclass; + + if (dev->sysctl_tree == NULL) + return; + sysctl_rename_oid(dev->sysctl_tree, dev->nameunit + strlen(dc->name)); +} + +static void device_sysctl_fini(device_t dev) { if (dev->sysctl_tree == NULL) @@ -2387,6 +2397,7 @@ device_attach(device_t dev) dev->state = DS_NOTPRESENT; return (error); } + device_sysctl_update(dev); dev->state = DS_ATTACHED; devadded(dev); return (0); |