diff options
author | imp <imp@FreeBSD.org> | 2009-03-09 13:20:23 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2009-03-09 13:20:23 +0000 |
commit | ee8ea378715a33154aa6b3c374e115815a89fd2b (patch) | |
tree | 025f97293f50b267c597a6d98aae70d648ee2345 /sys/dev/usb | |
parent | 0e6c8b2a3584a7a99d2b0609bb325b6d3b79b2c5 (diff) | |
download | FreeBSD-src-ee8ea378715a33154aa6b3c374e115815a89fd2b.zip FreeBSD-src-ee8ea378715a33154aa6b3c374e115815a89fd2b.tar.gz |
Fix a long-standing bug in newbus. It was introduced when subclassing
was introduced. If you have a bus, say cardbus, that is derived from
a base-bus (say PCI), then ordinarily all PCI drivers would attach to
cardbus devices. However, there had been one exception: kldload
wouldn't work.
The problem is in devclass_add_driver. In this routine, all we did
was call to the pci device's BUS_DRIVER_ADDED routine. However, since
cardbus bus instances had a different devclass, none of them were
called.
The solution is to call all subclass devclasses, recursively down the
tree, of the class that was loaded. Since we don't have a 'children
class' pointer, we search the whole list of devclasses for a class
whose parent matches. Since just done a kldload time, this isn't as
bad as it sounds. In addition, we short-circuit the whole process by
marking those classes with subclasses with a flag. We'll likely have
to reevaluate this method the number of devclasses with subclasses
gets large.
This means we can remove the "cardbus" lines from all the PCI drivers
since we have no cardbus specific attach device attachments in the
tree.
# Also: minor tweak to an error message
Diffstat (limited to 'sys/dev/usb')
0 files changed, 0 insertions, 0 deletions