diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2017-06-28 15:13:58 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-07-02 16:14:24 -0500 |
commit | 4b380678f5a7d926ebe3ae163f0aff2faa925329 (patch) | |
tree | d7f49df97909d274879f4012b6a903836765e2cb /drivers/pci | |
parent | 527740765629142993966afbd7a836fc47fb30ee (diff) | |
download | linux-stable-4b380678f5a7d926ebe3ae163f0aff2faa925329.tar.gz linux-stable-4b380678f5a7d926ebe3ae163f0aff2faa925329.tar.bz2 linux-stable-4b380678f5a7d926ebe3ae163f0aff2faa925329.zip |
PCI: versatile: Convert PCI scan API to pci_scan_root_bus_bridge()
The introduction of pci_scan_root_bus_bridge() provides a PCI core API to
scan a PCI root bus backed by an already initialized struct pci_host_bridge
object, which simplifies the bus scan interface and makes the PCI scan root
bus interface easier to generalize as members are added to the struct
pci_host_bridge.
Convert PCI versatile host code to pci_scan_root_bus_bridge() to improve
the PCI root bus scanning interface.
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
[bhelgaas: folded in fix from Arnd Bergmann <arnd@arndb.de>:
http://lkml.kernel.org/r/20170621215323.3921382-3-arnd@arndb.de]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/host/pci-versatile.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/pci/host/pci-versatile.c b/drivers/pci/host/pci-versatile.c index 9281eee2d000..b3c325f451b6 100644 --- a/drivers/pci/host/pci-versatile.c +++ b/drivers/pci/host/pci-versatile.c @@ -125,8 +125,13 @@ static int versatile_pci_probe(struct platform_device *pdev) u32 val; void __iomem *local_pci_cfg_base; struct pci_bus *bus, *child; + struct pci_host_bridge *bridge; LIST_HEAD(pci_res); + bridge = devm_pci_alloc_host_bridge(&pdev->dev, 0); + if (!bridge) + return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); versatile_pci_base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(versatile_pci_base)) @@ -199,11 +204,20 @@ static int versatile_pci_probe(struct platform_device *pdev) pci_add_flags(PCI_ENABLE_PROC_DOMAINS); pci_add_flags(PCI_REASSIGN_ALL_BUS | PCI_REASSIGN_ALL_RSRC); - bus = pci_scan_root_bus(&pdev->dev, 0, &pci_versatile_ops, NULL, &pci_res); - if (!bus) - return -ENOMEM; + list_splice_init(&pci_res, &bridge->windows); + bridge->dev.parent = &pdev->dev; + bridge->sysdata = NULL; + bridge->busnr = 0; + bridge->ops = &pci_versatile_ops; + + ret = pci_scan_root_bus_bridge(bridge); + if (ret < 0) + return ret; + + bus = bridge->bus; pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); + pci_assign_unassigned_bus_resources(bus); list_for_each_entry(child, &bus->children, node) pcie_bus_configure_settings(child); |