linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Tom Joseph <tjoseph@cadence.com>
Subject: [PATCH 01/15] PCI: cadence: Use struct pci_host_bridge.windows list directly
Date: Fri, 22 May 2020 17:48:18 -0600	[thread overview]
Message-ID: <20200522234832.954484-2-robh@kernel.org> (raw)
In-Reply-To: <20200522234832.954484-1-robh@kernel.org>

There's no need to create a temporary resource list and then splice it to
struct pci_host_bridge.windows list. Just use pci_host_bridge.windows
directly. The necessary clean-up is already handled by the PCI core.

Cc: Tom Joseph <tjoseph@cadence.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 .../controller/cadence/pcie-cadence-host.c    | 26 +++++--------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
index 8c2543f28ba0..9f77e47983c3 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-host.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
@@ -169,14 +169,15 @@ static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
 }
 
 static int cdns_pcie_host_init(struct device *dev,
-			       struct list_head *resources,
 			       struct cdns_pcie_rc *rc)
 {
+	struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rc);
 	struct resource *bus_range = NULL;
 	int err;
 
 	/* Parse our PCI ranges and request their resources */
-	err = pci_parse_request_of_pci_ranges(dev, resources, NULL, &bus_range);
+	err = pci_parse_request_of_pci_ranges(dev, &bridge->windows, NULL,
+					      &bus_range);
 	if (err)
 		return err;
 
@@ -185,17 +186,9 @@ static int cdns_pcie_host_init(struct device *dev,
 
 	err = cdns_pcie_host_init_root_port(rc);
 	if (err)
-		goto err_out;
-
-	err = cdns_pcie_host_init_address_translation(rc);
-	if (err)
-		goto err_out;
-
-	return 0;
+		return err;
 
- err_out:
-	pci_free_resource_list(resources);
-	return err;
+	return cdns_pcie_host_init_address_translation(rc);
 }
 
 int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
@@ -204,7 +197,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 	struct platform_device *pdev = to_platform_device(dev);
 	struct device_node *np = dev->of_node;
 	struct pci_host_bridge *bridge;
-	struct list_head resources;
 	struct cdns_pcie *pcie;
 	struct resource *res;
 	int ret;
@@ -248,11 +240,10 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 
 	pcie->mem_res = res;
 
-	ret = cdns_pcie_host_init(dev, &resources, rc);
+	ret = cdns_pcie_host_init(dev, rc);
 	if (ret)
 		goto err_init;
 
-	list_splice_init(&resources, &bridge->windows);
 	bridge->dev.parent = dev;
 	bridge->busnr = pcie->bus;
 	bridge->ops = &cdns_pcie_host_ops;
@@ -261,13 +252,10 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
 
 	ret = pci_host_probe(bridge);
 	if (ret < 0)
-		goto err_host_probe;
+		goto err_init;
 
 	return 0;
 
- err_host_probe:
-	pci_free_resource_list(&resources);
-
  err_init:
 	pm_runtime_put_sync(dev);
 
-- 
2.25.1


  reply	other threads:[~2020-05-22 23:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22 23:48 [PATCH 00/15] PCI controller probe cleanups Rob Herring
2020-05-22 23:48 ` Rob Herring [this message]
2020-05-22 23:48 ` [PATCH 02/15] PCI: mvebu: Use struct pci_host_bridge.windows list directly Rob Herring
2020-05-22 23:48 ` [PATCH 03/15] PCI: host-common: " Rob Herring
2020-05-22 23:48 ` [PATCH 04/15] PCI: brcmstb: Use pci_host_probe() to register host Rob Herring
2020-06-18 10:54   ` Nicolas Saenz Julienne
2020-05-22 23:48 ` [PATCH 05/15] PCI: mobiveil: " Rob Herring
2020-05-22 23:48 ` [PATCH 06/15] PCI: tegra: " Rob Herring
2020-05-22 23:48 ` [PATCH 07/15] PCI: v3: " Rob Herring
2020-05-25 11:38   ` Linus Walleij
2020-05-22 23:48 ` [PATCH 08/15] PCI: versatile: " Rob Herring
2020-05-22 23:48 ` [PATCH 09/15] PCI: xgene: " Rob Herring
2020-05-22 23:48 ` [PATCH 10/15] PCI: altera: " Rob Herring
2020-06-02  1:02   ` Tan, Ley Foon
2020-05-22 23:48 ` [PATCH 11/15] PCI: iproc: " Rob Herring
2020-05-28 17:53   ` Scott Branden
2020-05-22 23:48 ` [PATCH 12/15] PCI: rcar: " Rob Herring
2020-05-25  8:31   ` Geert Uytterhoeven
2020-05-22 23:48 ` [PATCH 13/15] PCI: rockchip: " Rob Herring
2020-05-22 23:48 ` [PATCH 14/15] PCI: xilinx-nwl: " Rob Herring
2020-05-25  6:44   ` Michal Simek
2020-05-22 23:48 ` [PATCH 15/15] PCI: xilinx: " Rob Herring
2020-05-25  6:44   ` Michal Simek
2020-07-06  9:04 ` [PATCH 00/15] PCI controller probe cleanups Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200522234832.954484-2-robh@kernel.org \
    --to=robh@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=tjoseph@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).