Page MenuHomeFreeBSD
Paste P651

Command-Line Input
ActivePublic

Authored by jhb on Nov 20 2024, 10:04 PM.
Tags
None
Referenced Files
F103095165: Command-Line Input
Nov 20 2024, 10:04 PM
Subscribers
None
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 2dbe1072aa83..0b8030904463 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -2592,6 +2592,8 @@ device_attach(device_t dev)
if (resource_disabled(dev->driver->name, dev->unit)) {
device_disable(dev);
+ (void)device_set_driver(dev, NULL);
+ dev->state = DS_NOTPRESENT;
if (bootverbose)
device_printf(dev, "disabled via hints entry\n");
return (ENXIO);
@@ -5759,17 +5761,20 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
* attach the device rather than doing a full probe.
*/
device_enable(dev);
- if (device_is_alive(dev)) {
+ if (dev->devclass != NULL) {
/*
* If the device was disabled via a hint, clear
* the hint.
*/
- if (resource_disabled(dev->driver->name, dev->unit))
- resource_unset_value(dev->driver->name,
+ if (resource_disabled(dev->devclass->name, dev->unit))
+ resource_unset_value(dev->devclass->name,
dev->unit, "disabled");
- error = device_attach(dev);
- } else
- error = device_probe_and_attach(dev);
+
+ /* Allow any drivers to rebid. */
+ if (!(dev->flags & DF_FIXEDCLASS))
+ devclass_delete_device(dev->devclass, dev);
+ }
+ error = device_probe_and_attach(dev);
break;
case DEV_DISABLE:
if (!device_is_enabled(dev)) {

Event Timeline