Add a bus_null_rescan() method that always fails with an error.

Use this in place of kobj_error_method to disable BUS_RESCAN() on
PCI drivers that do not use the "standard" scanning algorithm.
This commit is contained in:
John Baldwin 2016-04-27 17:49:42 +00:00
parent 67e7d085ae
commit e240255ffc
6 changed files with 18 additions and 4 deletions

View File

@ -346,7 +346,7 @@ static device_method_t cardbus_methods[] = {
DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag),
DEVMETHOD(bus_read_ivar, cardbus_read_ivar),
DEVMETHOD(bus_driver_added, cardbus_driver_added),
DEVMETHOD(bus_rescan, kobj_error_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
/* Card Interface */
DEVMETHOD(card_attach_card, cardbus_attach_card),

View File

@ -4289,6 +4289,19 @@ bus_generic_get_domain(device_t dev, device_t child, int *domain)
return (ENOENT);
}
/**
* @brief Helper function for implementing BUS_RESCAN().
*
* This null implementation of BUS_RESCAN() always fails to indicate
* the bus does not support rescanning.
*/
int
bus_null_rescan(device_t dev)
{
return (ENXIO);
}
/*
* Some convenience functions to make it easier for drivers to use the
* resource-management functions. All these really do is hide the

View File

@ -154,7 +154,7 @@ static device_method_t xlp_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, xlp_pci_probe),
DEVMETHOD(device_attach, xlp_pci_attach),
DEVMETHOD(bus_rescan, kobj_error_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
DEVMETHOD_END
};

View File

@ -77,7 +77,7 @@ static device_method_t ofw_pcibus_methods[] = {
/* Bus interface */
DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted),
DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_child_pnpinfo_str_method),
DEVMETHOD(bus_rescan, kobj_error_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
/* PCI interface */
DEVMETHOD(pci_alloc_devinfo, ofw_pcibus_alloc_devinfo),

View File

@ -81,7 +81,7 @@ static device_method_t ofw_pcibus_methods[] = {
/* Bus interface */
DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted),
DEVMETHOD(bus_child_pnpinfo_str, ofw_pcibus_pnpinfo_str),
DEVMETHOD(bus_rescan, kobj_error_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
/* PCI interface */
DEVMETHOD(pci_alloc_devinfo, ofw_pcibus_alloc_devinfo),

View File

@ -430,6 +430,7 @@ int bus_generic_teardown_intr(device_t dev, device_t child,
struct resource *irq, void *cookie);
int bus_generic_write_ivar(device_t dev, device_t child, int which,
uintptr_t value);
int bus_null_rescan(device_t dev);
/*
* Wrapper functions for the BUS_*_RESOURCE methods to make client code