subr_bus: restore bus_null_rescan()

Partially revert the previous change; we need to keep this method as a
specific override for pci_driver subclasses which should not use
pci_rescan_method() -- cardbus and ofw_pcibus. However, change the return
value to ENODEV for the same reasoning given in the original commit, and
use this as the default rescan method in bus_if.m.

Reported by:	jhb
Fixes:		36a8572ee8 ("bus_if: provide a default null rescan method")
MFC with:	36a8572ee8
This commit is contained in:
Mitchell Horne 2022-06-23 15:44:28 -03:00
parent a85bbbea91
commit 29afffb942
5 changed files with 17 additions and 7 deletions

View File

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

View File

@ -78,12 +78,6 @@ CODE {
{ {
return (0); return (0);
} }
static int
null_rescan(device_t dev)
{
return (ENODEV);
}
}; };
/** /**
@ -260,7 +254,7 @@ METHOD device_t add_child {
*/ */
METHOD int rescan { METHOD int rescan {
device_t _dev; device_t _dev;
} DEFAULT null_rescan; } DEFAULT bus_null_rescan;
/** /**
* @brief Allocate a system resource * @brief Allocate a system resource

View File

@ -4708,6 +4708,19 @@ bus_generic_get_device_path(device_t bus, device_t child, const char *locator,
return (0); return (0);
} }
/**
* @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 (ENODEV);
}
/* /*
* Some convenience functions to make it easier for drivers to use the * Some convenience functions to make it easier for drivers to use the
* resource-management functions. All these really do is hide the * resource-management functions. All these really do is hide the

View File

@ -81,6 +81,7 @@ static device_method_t ofw_pcibus_methods[] = {
/* Bus interface */ /* Bus interface */
DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted), DEVMETHOD(bus_child_deleted, ofw_pcibus_child_deleted),
DEVMETHOD(bus_child_pnpinfo, ofw_pcibus_child_pnpinfo_method), DEVMETHOD(bus_child_pnpinfo, ofw_pcibus_child_pnpinfo_method),
DEVMETHOD(bus_rescan, bus_null_rescan),
DEVMETHOD(bus_get_cpus, ofw_pcibus_get_cpus), DEVMETHOD(bus_get_cpus, ofw_pcibus_get_cpus),
DEVMETHOD(bus_get_domain, ofw_pcibus_get_domain), DEVMETHOD(bus_get_domain, ofw_pcibus_get_domain),

View File

@ -513,6 +513,7 @@ int bus_generic_get_device_path(device_t bus, device_t child, const char *locato
struct sbuf *sb); struct sbuf *sb);
int bus_helper_reset_post(device_t dev, int flags); int bus_helper_reset_post(device_t dev, int flags);
int bus_helper_reset_prepare(device_t dev, int flags); int bus_helper_reset_prepare(device_t dev, int flags);
int bus_null_rescan(device_t dev);
/* /*
* Wrapper functions for the BUS_*_RESOURCE methods to make client code * Wrapper functions for the BUS_*_RESOURCE methods to make client code