diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index b1ff02a..68ed5d8 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -186,6 +186,14 @@ int pci_bus_add_device(struct pci_dev *dev) return 0; } +void __weak pcibios_add_bus(struct pci_bus *bus) +{ +} + +void __weak pcibios_remove_bus(struct pci_bus *bus) +{ +} + /** * pci_bus_add_devices - start driver for PCI devices * @bus: bus to check for new devices @@ -198,6 +206,11 @@ void pci_bus_add_devices(const struct pci_bus *bus) struct pci_bus *child; int retval; + if (bus->is_added == 1) { + pcibios_add_bus(bus); + bus->is_added++; + } + list_for_each_entry(dev, &bus->devices, bus_list) { /* Skip already-added devices */ if (dev->is_added) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 3dfc907..51404e6 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -704,8 +704,6 @@ add_dev: ret = device_add(&child->dev); WARN_ON(ret < 0); - pcibios_add_bus(child); - /* Create legacy_io and legacy_mem files for this bus */ pci_create_legacy_files(child); @@ -1688,14 +1686,6 @@ int __weak pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) return 0; } -void __weak pcibios_add_bus(struct pci_bus *bus) -{ -} - -void __weak pcibios_remove_bus(struct pci_bus *bus) -{ -} - struct pci_bus *pci_create_root_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources) { @@ -1742,8 +1732,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, if (error) goto class_dev_reg_err; - pcibios_add_bus(b); - /* Create legacy_io and legacy_mem files for this bus */ pci_create_legacy_files(b);