Any driver that relies on its parent to set the devclass has no way to

know if has siblings that need an actual probe.  Introduce a specail
return value called BUS_PROBE_NOOWILDCARD.  If the driver returns
this, the probe is only successful for devices that have had a
specific devclass set for them.

Reviewed by: current@, jhb@, grehan@
This commit is contained in:
Warner Losh 2008-03-09 05:10:22 +00:00
parent 27080415a2
commit 908e1e5df5
2 changed files with 13 additions and 1 deletions

View File

@ -1777,6 +1777,14 @@ device_probe_child(device_t dev, device_t child)
* of pri for the first match.
*/
if (best == NULL || result > pri) {
/*
* Probes that return BUS_PROBE_NOWILDCARD
* or lower only match when they are set
* in stone by the parent bus.
*/
if (result <= BUS_PROBE_NOWILDCARD &&
child->flags & DF_WILDCARD)
continue;
best = dl;
pri = result;
continue;

View File

@ -494,7 +494,10 @@ void bus_data_generation_update(void);
* is for drivers that wish to have a generic form and a specialized form,
* like is done with the pci bus and the acpi pci bus. BUS_PROBE_HOOVER is
* for those busses that implement a generic device place-holder for devices on
* the bus that have no more specific driver for them (aka ugen).
* the bus that have no more specific river for them (aka ugen).
* BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding
* for a device node, but accepts only devices that its parent has told it
* use this driver.
*/
#define BUS_PROBE_SPECIFIC 0 /* Only I can use this device */
#define BUS_PROBE_VENDOR (-10) /* Vendor supplied driver */
@ -502,6 +505,7 @@ void bus_data_generation_update(void);
#define BUS_PROBE_LOW_PRIORITY (-40) /* Older, less desirable drivers */
#define BUS_PROBE_GENERIC (-100) /* generic driver for dev */
#define BUS_PROBE_HOOVER (-500) /* Generic dev for all devs on bus */
#define BUS_PROBE_NOWILDCARD (-2000000000) /* No wildcard device matches */
/**
* Shorthand for constructing method tables.