Deal with the possibility of device_set_unit() being called when attaching

the associated devinfo sysctl tree.
This commit is contained in:
peter 2007-11-30 21:30:14 +00:00
parent 8959a77f75
commit e287ae6b7a

View File

@ -306,6 +306,16 @@ device_sysctl_init(device_t dev)
"parent device");
}
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)
{
@ -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);