sparc/PCI: convert to pci_create_root_bus()
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 28 Oct 2011 22:27:53 +0000 (16:27 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 6 Jan 2012 20:11:11 +0000 (12:11 -0800)
Convert from pci_create_bus() to pci_create_root_bus().  This way the root
bus resources are correct immediately.  This patch doesn't fix a problem
because sparc fixed the resources before scanning the bus, but it makes
sparc more consistent with other architectures.

v2: fix build error (from sfr)

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
arch/sparc/kernel/pci.c

index 130f07ac4d61cf51efc2d12cd595bba55c34a7e5..bb8bc2e519ac03735f79361d7b400eccee08b8ba 100644 (file)
@@ -685,23 +685,25 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
 struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
                                            struct device *parent)
 {
+       LIST_HEAD(resources);
        struct device_node *node = pbm->op->dev.of_node;
        struct pci_bus *bus;
 
        printk("PCI: Scanning PBM %s\n", node->full_name);
 
-       bus = pci_create_bus(parent, pbm->pci_first_busno, pbm->pci_ops, pbm);
+       pci_add_resource(&resources, &pbm->io_space);
+       pci_add_resource(&resources, &pbm->mem_space);
+       bus = pci_create_root_bus(parent, pbm->pci_first_busno, pbm->pci_ops,
+                                 pbm, &resources);
        if (!bus) {
                printk(KERN_ERR "Failed to create bus for %s\n",
                       node->full_name);
+               pci_free_resource_list(&resources);
                return NULL;
        }
        bus->secondary = pbm->pci_first_busno;
        bus->subordinate = pbm->pci_last_busno;
 
-       bus->resource[0] = &pbm->io_space;
-       bus->resource[1] = &pbm->mem_space;
-
        pci_of_scan_bus(pbm, node, bus);
        pci_bus_add_devices(bus);
        pci_bus_register_of_sysfs(bus);
@@ -711,13 +713,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm,
 
 void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
 {
-       struct pci_pbm_info *pbm = pbus->sysdata;
-
-       /* Generic PCI bus probing sets these to point at
-        * &io{port,mem}_resouce which is wrong for us.
-        */
-       pbus->resource[0] = &pbm->io_space;
-       pbus->resource[1] = &pbm->mem_space;
 }
 
 void pcibios_update_irq(struct pci_dev *pdev, int irq)