Commit 669cbc70 authored by Rob Herring's avatar Rob Herring Committed by Lorenzo Pieralisi
Browse files

PCI: Move DT resource setup into devm_pci_alloc_host_bridge()

Now that pci_parse_request_of_pci_ranges() callers just setup
pci_host_bridge.windows and dma_ranges directly and don't need the bus
range returned, we can just initialize them when allocating the
pci_host_bridge struct.

With this, pci_parse_request_of_pci_ranges() becomes a static function.

Link: https://lore.kernel.org/r/20200722022514.1283916-19-robh@kernel.org


Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
parent 4a957563
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -171,14 +171,8 @@ static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
static int cdns_pcie_host_init(struct device *dev,
			       struct cdns_pcie_rc *rc)
{
	struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rc);
	int err;

	/* Parse our PCI ranges and request their resources */
	err = pci_parse_request_of_pci_ranges(dev, &bridge->windows, NULL, NULL);
	if (err)
		return err;

	err = cdns_pcie_host_init_root_port(rc);
	if (err)
		return err;
+0 −5
Original line number Diff line number Diff line
@@ -346,11 +346,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
	if (!bridge)
		return -ENOMEM;

	ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
					      &bridge->dma_ranges, NULL);
	if (ret)
		return ret;

	/* Get the I/O and memory ranges from DT */
	resource_list_for_each_entry(win, &bridge->windows) {
		switch (resource_type(win->res)) {
+0 −8
Original line number Diff line number Diff line
@@ -577,14 +577,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
	if (!mobiveil_pcie_is_bridge(pcie))
		return -ENODEV;

	/* parse the host bridge base addresses from the device tree file */
	ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
					      &bridge->dma_ranges, NULL);
	if (ret) {
		dev_err(dev, "Getting bridge resources failed\n");
		return ret;
	}

	/*
	 * configure all inbound and outbound windows and prepare the RC for
	 * config access
+0 −7
Original line number Diff line number Diff line
@@ -1130,13 +1130,6 @@ static int advk_pcie_probe(struct platform_device *pdev)
		return ret;
	}

	ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
					      &bridge->dma_ranges, NULL);
	if (ret) {
		dev_err(dev, "Failed to parse resources\n");
		return ret;
	}

	pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node,
						       "reset-gpios", 0,
						       GPIOD_OUT_LOW,
+0 −5
Original line number Diff line number Diff line
@@ -465,11 +465,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
	if (IS_ERR(p->base))
		return PTR_ERR(p->base);

	ret = pci_parse_request_of_pci_ranges(dev, &host->windows,
					      &host->dma_ranges, NULL);
	if (ret)
		return ret;

	win = resource_list_first_type(&host->windows, IORESOURCE_IO);
	if (win) {
		io = win->res;
Loading