diff options
author | jhb <jhb@FreeBSD.org> | 2012-02-27 16:08:18 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2012-02-27 16:08:18 +0000 |
commit | 4110bb206bc0bd2ea81164dc7f0f861d50674b40 (patch) | |
tree | b73112712dcc6e16414eb303a76339fdf8982a82 /sys/kern/subr_bus.c | |
parent | 96aacc2279b7b65fc0c8ff707abe3d020c1e8378 (diff) | |
download | FreeBSD-src-4110bb206bc0bd2ea81164dc7f0f861d50674b40.zip FreeBSD-src-4110bb206bc0bd2ea81164dc7f0f861d50674b40.tar.gz |
Clear the a device's description string anytime it's driver changes.
Descriptions are specific to drivers and we don't change drivers on attached
devices. This fixes a few places where we were not clearing the description
when detaching a driver (e.g. with device_attach() failed). While here, fix
a few other nits:
- Remove spurious call to remove a device's driver from
devclass_driver_deleted(). device_detach() removes it already.
- Fix a typo.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r-- | sys/kern/subr_bus.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index cc74204..f44c353 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1129,7 +1129,6 @@ devclass_driver_deleted(devclass_t busclass, devclass_t dc, driver_t *driver) dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2097,7 +2096,7 @@ device_probe_child(device_t dev, device_t child) /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2604,6 +2603,7 @@ device_set_driver(device_t dev, driver_t *driver) free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2789,7 +2789,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); |