sparc32, leon/PCI: convert to pci_scan_root_bus() for correct root bus resources
authorBjorn Helgaas <bhelgaas@google.com>
Fri, 28 Oct 2011 22:27:58 +0000 (16:27 -0600)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Fri, 6 Jan 2012 20:11:11 +0000 (12:11 -0800)
Convert from pci_scan_bus_parented() to pci_scan_root_bus() and remove root
bus resource fixups.  This fixes the problem of "early" and "header" quirks
seeing incorrect root bus resources.

pci_scan_root_bus() also includes the pci_bus_add_devices() so we don't
need to do that separately.

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/leon_pci.c

index f1cf6ef011a724b8f45dbff51dc09002b841637b..c7bec25fdb1c1b5d18d67c6882437c5475354d31 100644 (file)
  */
 void leon_pci_init(struct platform_device *ofdev, struct leon_pci_info *info)
 {
+       LIST_HEAD(resources);
        struct pci_bus *root_bus;
 
-       root_bus = pci_scan_bus_parented(&ofdev->dev, 0, info->ops, info);
-       if (root_bus) {
-               root_bus->resource[0] = &info->io_space;
-               root_bus->resource[1] = &info->mem_space;
-               root_bus->resource[2] = NULL;
-
-               /* Init all PCI devices into PCI tree */
-               pci_bus_add_devices(root_bus);
+       pci_add_resource(&resources, &info->io_space);
+       pci_add_resource(&resources, &info->mem_space);
 
+       root_bus = pci_scan_root_bus(&ofdev->dev, 0, info->ops, info,
+                                    &resources);
+       if (root_bus) {
                /* Setup IRQs of all devices using custom routines */
                pci_fixup_irqs(pci_common_swizzle, info->map_irq);
 
                /* Assign devices with resources */
                pci_assign_unassigned_resources();
+       } else {
+               pci_free_resource_list(&resources);
        }
 }
 
@@ -83,15 +83,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
        int i, has_io, has_mem;
        u16 cmd;
 
-       /* Generic PCI bus probing sets these to point at
-        * &io{port,mem}_resouce which is wrong for us.
-        */
-       if (pbus->self == NULL) {
-               pbus->resource[0] = &info->io_space;
-               pbus->resource[1] = &info->mem_space;
-               pbus->resource[2] = NULL;
-       }
-
        list_for_each_entry(dev, &pbus->devices, bus_list) {
                /*
                 * We can not rely on that the bootloader has enabled I/O