Subject: Re: looking for devices on PCI bus
To: None <email@example.com, firstname.lastname@example.org>
From: None <email@example.com>
Date: 05/03/2001 00:33:44
> You need to re-probe every device on the bus to see if it has been
> added, removed, or *replaced* with something different. For that,
> we need to keep around the locator information used during the original
Right, though my suggestion is to keep around the info from the original
match, not just attach. :-) That way things work even for unsupported
drivers. My definition of "fast enough" scanning was an effort to try and
keep things to just having to deal with add & removed items.
No point in keeping info for unattached devices. It takes up space that
can be better used for something else, and by the time the information is
needed again a hotplug event could occur, rendering the information obsolete.
> * One problem with drivers loaded from an LKM is if the device
> can be managed by multiple drivers and you need to select the
> most appropriate one. If another, less apropriate driver has
> already attached to that device, things get complicated. Do
> you unconfigure the device and then reprobe and reconfigure, or
> just forget about the whole thing and use the old driver?
I was hoping no one would bring this up. :-)
Probably the best thing to do would be when we are scanning for existing
devices which are matched by the new LKM to note if the device is attached
or not. If it's not attached, things are easy. If it is matched, then
either the LKM driver needs to ignore the device, or decide to get the
existing driver to detach, and then have the new driver attach. Oh, and to
be nice, it should probably gain as much state info before detach as
Oh, and the routine which adds match routines should be told if it should
add the new routine to the front or the back, so that future scans will
favor either the LKM or an in-kernel driver.
Attachment decisions should be based on the value returned by the match
routine. If you want to support replacing the driver you should:
Detach the existing driver so any probes do not interfere with the device
Call all the device match routines again to get the match level.
Select the driver with the best match, and attach it, possibly the same
driver that was previously detached.