diff options
author | njl <njl@FreeBSD.org> | 2004-10-14 17:14:56 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-10-14 17:14:56 +0000 |
commit | 846d39b0ea42519bd3866486f47870c790963682 (patch) | |
tree | b2fc5a9489a5d85af42826112d7ac901beef9f33 /sys | |
parent | f3d4cd1ba7cccf03988fb6a61d4211a222822395 (diff) | |
download | FreeBSD-src-846d39b0ea42519bd3866486f47870c790963682.zip FreeBSD-src-846d39b0ea42519bd3866486f47870c790963682.tar.gz |
Update flags patch for the !ISA case.
* Get flags first, in case there is no devclass.
* Reset flags after each probe in case the next driver has no hints so it
doesn't inherit the old ones.
* Set them again before the winning probe.
Tested ok both with and without ACPI for ISA device flags.
Reviewed by: imp
MFC after: 1 day
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_bus.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 5ad739c..95d7fb3 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1578,7 +1578,15 @@ device_probe_child(device_t dev, device_t child) device_set_driver(child, dl->driver); if (!hasclass) device_set_devclass(child, dl->driver->name); + + /* Fetch any flags for the device before probing. */ + resource_int_value(dl->driver->name, child->unit, + "flags", &child->devflags); + result = DEVICE_PROBE(child); + + /* Reset flags and devclass before the next probe. */ + child->devflags = 0; if (!hasclass) device_set_devclass(child, 0); @@ -1645,9 +1653,14 @@ device_probe_child(device_t dev, device_t child) if (child->state > DS_ALIVE && best->driver != child->driver) if ((result = device_detach(dev)) != 0) return (result); + + /* Set the winning driver, devclass, and flags. */ if (!child->devclass) device_set_devclass(child, best->driver->name); device_set_driver(child, best->driver); + resource_int_value(best->driver->name, child->unit, + "flags", &child->devflags); + if (pri < 0) { /* * A bit bogus. Call the probe method again to make @@ -2074,7 +2087,7 @@ int device_set_devclass(device_t dev, const char *classname) { devclass_t dc; - int error, flags; + int error; if (!classname) { if (dev->devclass) @@ -2093,10 +2106,6 @@ device_set_devclass(device_t dev, const char *classname) error = devclass_add_device(dc, dev); - /* Fetch any hints for the device before it is probed. */ - if (resource_int_value(classname, dev->unit, "flags", &flags) == 0) - dev->devflags = flags; - bus_data_generation_update(); return (error); } |