diff mbox series

[RFC,14/27] PCI: Also call .add_bus() callback for root bus

Message ID 20200803210116.3132633-15-robh@kernel.org
State Superseded
Headers show
Series [RFC,01/27] PCI: Allow root and child buses to have different pci_ops | expand

Commit Message

Rob Herring Aug. 3, 2020, 9:01 p.m. UTC
Similar to pcibios_add_bus(), call pci_ops.add_bus() when the root bus
is added. This allows host bridge drivers to do any setup requiring a
bus pointer.

There are currently no .add_bus() callbacks, so this is safe to do.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Rob Herring <robh@kernel.org>

---
 drivers/pci/probe.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.25.1
diff mbox series

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 8712e595174d..337a3b7766ca 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -935,6 +935,12 @@  static int pci_register_host_bridge(struct pci_host_bridge *bridge)
 
 	pcibios_add_bus(bus);
 
+	if (bus->ops->add_bus) {
+		err = bus->ops->add_bus(bus);
+		if (WARN_ON(err < 0))
+			dev_err(&bus->dev, "failed to add bus: %d\n", err);
+	}
+
 	/* Create legacy_io and legacy_mem files for this bus */
 	pci_create_legacy_files(bus);