Commit 4246a864 authored by Lorenzo Pieralisi's avatar Lorenzo Pieralisi Committed by Bjorn Helgaas

PCI: generic: 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 host-common code to pci_scan_root_bus_bridge() to improve the
PCI root bus scanning interface.
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
parent 9af275be
...@@ -117,8 +117,14 @@ int pci_host_common_probe(struct platform_device *pdev, ...@@ -117,8 +117,14 @@ int pci_host_common_probe(struct platform_device *pdev,
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
struct pci_bus *bus, *child; struct pci_bus *bus, *child;
struct pci_host_bridge *bridge;
struct pci_config_window *cfg; struct pci_config_window *cfg;
struct list_head resources; struct list_head resources;
int ret;
bridge = devm_pci_alloc_host_bridge(dev, 0);
if (!bridge)
return -ENOMEM;
type = of_get_property(np, "device_type", NULL); type = of_get_property(np, "device_type", NULL);
if (!type || strcmp(type, "pci")) { if (!type || strcmp(type, "pci")) {
...@@ -138,13 +144,20 @@ int pci_host_common_probe(struct platform_device *pdev, ...@@ -138,13 +144,20 @@ int pci_host_common_probe(struct platform_device *pdev,
if (!pci_has_flag(PCI_PROBE_ONLY)) if (!pci_has_flag(PCI_PROBE_ONLY))
pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS); pci_add_flags(PCI_REASSIGN_ALL_RSRC | PCI_REASSIGN_ALL_BUS);
bus = pci_scan_root_bus(dev, cfg->busr.start, &ops->pci_ops, cfg, list_splice_init(&resources, &bridge->windows);
&resources); bridge->dev.parent = dev;
if (!bus) { bridge->sysdata = cfg;
dev_err(dev, "Scanning rootbus failed"); bridge->busnr = cfg->busr.start;
return -ENODEV; bridge->ops = &ops->pci_ops;
ret = pci_scan_root_bus_bridge(bridge);
if (ret < 0) {
dev_err(dev, "Scanning root bridge failed");
return ret;
} }
bus = bridge->bus;
#ifdef CONFIG_ARM #ifdef CONFIG_ARM
pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment