Skip to content

Commit b411b2e

Browse files
robherringLorenzo Pieralisi
authored andcommitted
PCI: rcar: Use struct pci_host_bridge.windows list directly
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. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Yoshihiro Shimoda <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: [email protected] Cc: [email protected]
1 parent 61f11f8 commit b411b2e

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

drivers/pci/controller/pcie-rcar-host.c

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ struct rcar_pcie_host {
5353
struct device *dev;
5454
struct phy *phy;
5555
void __iomem *base;
56-
struct list_head resources;
5756
struct clk *bus_clk;
5857
struct rcar_msi msi;
5958
int (*phy_init_fn)(struct rcar_pcie_host *host);
@@ -203,38 +202,6 @@ static struct pci_ops rcar_pcie_ops = {
203202
.write = rcar_pcie_write_conf,
204203
};
205204

206-
static int rcar_pcie_setup(struct list_head *resource,
207-
struct rcar_pcie_host *host)
208-
{
209-
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
210-
struct resource_entry *win;
211-
int i = 0;
212-
213-
/* Setup PCI resources */
214-
resource_list_for_each_entry(win, &host->resources) {
215-
struct resource *res = win->res;
216-
217-
if (!res->flags)
218-
continue;
219-
220-
switch (resource_type(res)) {
221-
case IORESOURCE_IO:
222-
case IORESOURCE_MEM:
223-
rcar_pcie_set_outbound(&host->pcie, i, win);
224-
i++;
225-
break;
226-
case IORESOURCE_BUS:
227-
break;
228-
default:
229-
continue;
230-
}
231-
232-
pci_add_resource(resource, res);
233-
}
234-
235-
return 1;
236-
}
237-
238205
static void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
239206
{
240207
struct device *dev = pcie->dev;
@@ -292,6 +259,7 @@ static void rcar_pcie_force_speedup(struct rcar_pcie *pcie)
292259
static void rcar_pcie_hw_enable(struct rcar_pcie_host *host)
293260
{
294261
struct rcar_pcie *pcie = &host->pcie;
262+
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
295263
struct resource_entry *win;
296264
LIST_HEAD(res);
297265
int i = 0;
@@ -300,7 +268,7 @@ static void rcar_pcie_hw_enable(struct rcar_pcie_host *host)
300268
rcar_pcie_force_speedup(pcie);
301269

302270
/* Setup PCI resources */
303-
resource_list_for_each_entry(win, &host->resources) {
271+
resource_list_for_each_entry(win, &bridge->windows) {
304272
struct resource *res = win->res;
305273

306274
if (!res->flags)
@@ -319,12 +287,8 @@ static void rcar_pcie_hw_enable(struct rcar_pcie_host *host)
319287
static int rcar_pcie_enable(struct rcar_pcie_host *host)
320288
{
321289
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
322-
struct rcar_pcie *pcie = &host->pcie;
323290

324-
/* Try setting 5 GT/s link speed */
325-
rcar_pcie_force_speedup(pcie);
326-
327-
rcar_pcie_setup(&bridge->windows, host);
291+
rcar_pcie_hw_enable(host);
328292

329293
pci_add_flags(PCI_REASSIGN_ALL_BUS);
330294

@@ -949,7 +913,7 @@ static int rcar_pcie_probe(struct platform_device *pdev)
949913
pcie->dev = dev;
950914
platform_set_drvdata(pdev, host);
951915

952-
err = pci_parse_request_of_pci_ranges(dev, &host->resources,
916+
err = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
953917
&bridge->dma_ranges, NULL);
954918
if (err)
955919
return err;
@@ -1032,7 +996,6 @@ static int rcar_pcie_probe(struct platform_device *pdev)
1032996

1033997
err_pm_disable:
1034998
pm_runtime_disable(dev);
1035-
pci_free_resource_list(&host->resources);
1036999

10371000
return err;
10381001
}

0 commit comments

Comments
 (0)