Commit 0389e9be authored by Warner Losh's avatar Warner Losh
Browse files

bus: retire DF_REBID

I did DF_REBID to allow for 'hoover' drivers that would attach to
otherwise unattached devices in the tree. This notion didn't catch on as
it was tricky to make work well and it was easier to just publish a /dev
node of some flavor by the parent device. It's been nothing but dead
weight for a long time.

Reviewed by:		mav
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D32056
parent 364790be
...@@ -2083,10 +2083,9 @@ device_probe_child(device_t dev, device_t child) ...@@ -2083,10 +2083,9 @@ device_probe_child(device_t dev, device_t child)
panic("device_probe_child: parent device has no devclass"); panic("device_probe_child: parent device has no devclass");
/* /*
* If the state is already probed, then return. However, don't * If the state is already probed, then return.
* return if we can rebid this object.
*/ */
if (child->state == DS_ALIVE && (child->flags & DF_REBID) == 0) if (child->state == DS_ALIVE)
return (0); return (0);
for (; dc; dc = dc->parent) { for (; dc; dc = dc->parent) {
...@@ -2188,29 +2187,7 @@ device_probe_child(device_t dev, device_t child) ...@@ -2188,29 +2187,7 @@ device_probe_child(device_t dev, device_t child)
/* /*
* If we found a driver, change state and initialise the devclass. * If we found a driver, change state and initialise the devclass.
*/ */
/* XXX What happens if we rebid and got no best? */
if (best) { if (best) {
/*
* 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
* because if the state is > DS_ALIVE, we know it must
* be.
*
* This assumes that all DF_REBID drivers can have
* their probe routine called at any time and that
* they are idempotent as well as completely benign in
* normal operations.
*
* We also have to make sure that the detach
* succeeded, otherwise we fail the operation (or
* maybe it should just fail silently? I'm torn).
*/
if (child->state > DS_ALIVE && best->driver != child->driver)
if ((result = device_detach(dev)) != 0)
return (result);
/* Set the winning driver, devclass, and flags. */ /* Set the winning driver, devclass, and flags. */
if (!child->devclass) { if (!child->devclass) {
result = device_set_devclass(child, best->driver->name); result = device_set_devclass(child, best->driver->name);
...@@ -2229,11 +2206,7 @@ device_probe_child(device_t dev, device_t child) ...@@ -2229,11 +2206,7 @@ device_probe_child(device_t dev, device_t child)
* sure that we have the right description. * sure that we have the right description.
*/ */
DEVICE_PROBE(child); DEVICE_PROBE(child);
#if 0 }
child->flags |= DF_REBID;
#endif
} else
child->flags &= ~DF_REBID;
child->state = DS_ALIVE; child->state = DS_ALIVE;
bus_data_generation_update(); bus_data_generation_update();
...@@ -2921,7 +2894,7 @@ device_probe(device_t dev) ...@@ -2921,7 +2894,7 @@ device_probe(device_t dev)
GIANT_REQUIRED; GIANT_REQUIRED;
if (dev->state >= DS_ALIVE && (dev->flags & DF_REBID) == 0) if (dev->state >= DS_ALIVE)
return (-1); return (-1);
if (!(dev->flags & DF_ENABLED)) { if (!(dev->flags & DF_ENABLED)) {
...@@ -4145,8 +4118,7 @@ bus_generic_driver_added(device_t dev, driver_t *driver) ...@@ -4145,8 +4118,7 @@ bus_generic_driver_added(device_t dev, driver_t *driver)
DEVICE_IDENTIFY(driver, dev); DEVICE_IDENTIFY(driver, dev);
TAILQ_FOREACH(child, &dev->children, link) { TAILQ_FOREACH(child, &dev->children, link) {
if (child->state == DS_NOTPRESENT || if (child->state == DS_NOTPRESENT)
(child->flags & DF_REBID))
device_probe_and_attach(child); device_probe_and_attach(child);
} }
} }
...@@ -5334,7 +5306,6 @@ print_device_short(device_t dev, int indent) ...@@ -5334,7 +5306,6 @@ print_device_short(device_t dev, int indent)
(dev->flags&DF_FIXEDCLASS? "fixed,":""), (dev->flags&DF_FIXEDCLASS? "fixed,":""),
(dev->flags&DF_WILDCARD? "wildcard,":""), (dev->flags&DF_WILDCARD? "wildcard,":""),
(dev->flags&DF_DESCMALLOCED? "descmalloced,":""), (dev->flags&DF_DESCMALLOCED? "descmalloced,":""),
(dev->flags&DF_REBID? "rebiddable,":""),
(dev->flags&DF_SUSPENDED? "suspended,":""), (dev->flags&DF_SUSPENDED? "suspended,":""),
(dev->ivars? "":"no "), (dev->ivars? "":"no "),
(dev->softc? "":"no "), (dev->softc? "":"no "),
...@@ -5736,7 +5707,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, ...@@ -5736,7 +5707,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
/* Perform the requested operation. */ /* Perform the requested operation. */
switch (cmd) { switch (cmd) {
case DEV_ATTACH: case DEV_ATTACH:
if (device_is_attached(dev) && (dev->flags & DF_REBID) == 0) if (device_is_attached(dev))
error = EBUSY; error = EBUSY;
else if (!device_is_enabled(dev)) else if (!device_is_enabled(dev))
error = ENXIO; error = ENXIO;
......
...@@ -90,7 +90,6 @@ struct u_device { ...@@ -90,7 +90,6 @@ struct u_device {
#define DF_QUIET 0x10 /* don't print verbose attach message */ #define DF_QUIET 0x10 /* don't print verbose attach message */
#define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */ #define DF_DONENOMATCH 0x20 /* don't execute DEVICE_NOMATCH again */
#define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */ #define DF_EXTERNALSOFTC 0x40 /* softc not allocated by us */
#define DF_REBID 0x80 /* Can rebid after attach */
#define DF_SUSPENDED 0x100 /* Device is suspended. */ #define DF_SUSPENDED 0x100 /* Device is suspended. */
#define DF_QUIET_CHILDREN 0x200 /* Default to quiet for all my children */ #define DF_QUIET_CHILDREN 0x200 /* Default to quiet for all my children */
#define DF_ATTACHED_ONCE 0x400 /* Has been attached at least once */ #define DF_ATTACHED_ONCE 0x400 /* Has been attached at least once */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment