diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2017-06-28 16:13:59 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-07-02 17:14:25 -0400 |
commit | 8c790a82add469a5e901bf612e2c30bf5085564d (patch) | |
tree | 20b26c51fd001668fb964e160ad7190395c9367c | |
parent | 9815791319a01be1ceca8b0b716219073b29a42d (diff) |
PCI: xilinx: 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 xilinx 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>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Michal Simek <michal.simek@xilinx.com>
-rw-r--r-- | drivers/pci/host/pcie-xilinx.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c index 2fe2df51f9f8..761f048480e9 100644 --- a/drivers/pci/host/pcie-xilinx.c +++ b/drivers/pci/host/pcie-xilinx.c | |||
@@ -633,6 +633,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev) | |||
633 | struct device *dev = &pdev->dev; | 633 | struct device *dev = &pdev->dev; |
634 | struct xilinx_pcie_port *port; | 634 | struct xilinx_pcie_port *port; |
635 | struct pci_bus *bus, *child; | 635 | struct pci_bus *bus, *child; |
636 | struct pci_host_bridge *bridge; | ||
636 | int err; | 637 | int err; |
637 | resource_size_t iobase = 0; | 638 | resource_size_t iobase = 0; |
638 | LIST_HEAD(res); | 639 | LIST_HEAD(res); |
@@ -640,9 +641,11 @@ static int xilinx_pcie_probe(struct platform_device *pdev) | |||
640 | if (!dev->of_node) | 641 | if (!dev->of_node) |
641 | return -ENODEV; | 642 | return -ENODEV; |
642 | 643 | ||
643 | port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); | 644 | bridge = devm_pci_alloc_host_bridge(dev, sizeof(*port)); |
644 | if (!port) | 645 | if (!bridge) |
645 | return -ENOMEM; | 646 | return -ENODEV; |
647 | |||
648 | port = pci_host_bridge_priv(bridge); | ||
646 | 649 | ||
647 | port->dev = dev; | 650 | port->dev = dev; |
648 | 651 | ||
@@ -671,17 +674,23 @@ static int xilinx_pcie_probe(struct platform_device *pdev) | |||
671 | if (err) | 674 | if (err) |
672 | goto error; | 675 | goto error; |
673 | 676 | ||
674 | bus = pci_create_root_bus(dev, 0, &xilinx_pcie_ops, port, &res); | 677 | |
675 | if (!bus) { | 678 | list_splice_init(&res, &bridge->windows); |
676 | err = -ENOMEM; | 679 | bridge->dev.parent = dev; |
677 | goto error; | 680 | bridge->sysdata = port; |
678 | } | 681 | bridge->busnr = 0; |
682 | bridge->ops = &xilinx_pcie_ops; | ||
679 | 683 | ||
680 | #ifdef CONFIG_PCI_MSI | 684 | #ifdef CONFIG_PCI_MSI |
681 | xilinx_pcie_msi_chip.dev = dev; | 685 | xilinx_pcie_msi_chip.dev = dev; |
682 | bus->msi = &xilinx_pcie_msi_chip; | 686 | bridge->msi = &xilinx_pcie_msi_chip; |
683 | #endif | 687 | #endif |
684 | pci_scan_child_bus(bus); | 688 | err = pci_scan_root_bus_bridge(bridge); |
689 | if (err < 0) | ||
690 | goto error; | ||
691 | |||
692 | bus = bridge->bus; | ||
693 | |||
685 | pci_assign_unassigned_bus_resources(bus); | 694 | pci_assign_unassigned_bus_resources(bus); |
686 | #ifndef CONFIG_MICROBLAZE | 695 | #ifndef CONFIG_MICROBLAZE |
687 | pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); | 696 | pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); |