aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-02-23 22:18:59 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-02-23 22:18:59 -0500
commita5390aa6dc3646b08bed421944cef0daf78ab994 (patch)
treec7c84410c2db3ca93e912135cd3c1722d4b644ac /drivers/pci
parent844393f4c5e309dd262b27796471c47e348b57a8 (diff)
PCI: don't publish new root bus until it's fully initialized
When pci_create_root_bus() adds the new struct pci_bus to the global pci_root_buses list, the bus becomes visible to other parts of the kernel, so it should be fully initialized. This patch delays adding the bus to the pci_root_buses list until after all the struct pci_bus initialization is finished. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/probe.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index dc904bd4b569..e4c0d1c6324d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1569,10 +1569,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
1569 goto err_out; 1569 goto err_out;
1570 } 1570 }
1571 1571
1572 down_write(&pci_bus_sem);
1573 list_add_tail(&b->node, &pci_root_buses);
1574 up_write(&pci_bus_sem);
1575
1576 dev->parent = parent; 1572 dev->parent = parent;
1577 dev->release = pci_release_bus_bridge_dev; 1573 dev->release = pci_release_bus_bridge_dev;
1578 dev_set_name(dev, "pci%04x:%02x", pci_domain_nr(b), bus); 1574 dev_set_name(dev, "pci%04x:%02x", pci_domain_nr(b), bus);
@@ -1612,6 +1608,10 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
1612 dev_info(&b->dev, "root bus resource %pR\n", res); 1608 dev_info(&b->dev, "root bus resource %pR\n", res);
1613 } 1609 }
1614 1610
1611 down_write(&pci_bus_sem);
1612 list_add_tail(&b->node, &pci_root_buses);
1613 up_write(&pci_bus_sem);
1614
1615 return b; 1615 return b;
1616 1616
1617class_dev_reg_err: 1617class_dev_reg_err: