Skip to content

Commit 4f5c883

Browse files
robherringLorenzo Pieralisi
authored andcommitted
PCI: Move setting pci_host_bridge.busnr out of host drivers
Most host drivers only parse the DT bus range to set the root bus number in pci_host_bridge.busnr. The ones that don't set busnr are buggy in that they ignore what's in DT. Let's set busnr in pci_scan_root_bus_bridge() where we already check for the bus resource and remove setting it in host drivers. 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: Jingoo Han <[email protected]> Cc: Gustavo Pimentel <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Thomas Petazzoni <[email protected]> Cc: Will Deacon <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jonathan Hunter <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Ryder Lee <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Yoshihiro Shimoda <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected]
1 parent 6176a5f commit 4f5c883

File tree

8 files changed

+4
-18
lines changed

8 files changed

+4
-18
lines changed

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
474474
}
475475

476476
bridge->sysdata = pp;
477-
bridge->busnr = pp->busn->start;
478477
bridge->ops = &dw_pcie_ops;
479478
bridge->map_irq = of_irq_parse_and_map_pci;
480479
bridge->swizzle_irq = pci_common_swizzle;

drivers/pci/controller/pci-aardvark.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,6 @@ static int advk_pcie_probe(struct platform_device *pdev)
11041104
{
11051105
struct device *dev = &pdev->dev;
11061106
struct advk_pcie *pcie;
1107-
struct resource *bus;
11081107
struct pci_host_bridge *bridge;
11091108
int ret, irq;
11101109

@@ -1132,12 +1131,11 @@ static int advk_pcie_probe(struct platform_device *pdev)
11321131
}
11331132

11341133
ret = pci_parse_request_of_pci_ranges(dev, &bridge->windows,
1135-
&bridge->dma_ranges, &bus);
1134+
&bridge->dma_ranges, NULL);
11361135
if (ret) {
11371136
dev_err(dev, "Failed to parse resources\n");
11381137
return ret;
11391138
}
1140-
bridge->busnr = bus->start;
11411139

11421140
pcie->reset_gpio = devm_gpiod_get_from_of_node(dev, dev->of_node,
11431141
"reset-gpios", 0,

drivers/pci/controller/pci-host-common.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ int pci_host_common_probe(struct platform_device *pdev)
7777
pci_add_flags(PCI_REASSIGN_ALL_BUS);
7878

7979
bridge->sysdata = cfg;
80-
bridge->busnr = cfg->busr.start;
8180
bridge->ops = (struct pci_ops *)&ops->pci_ops;
8281
bridge->map_irq = of_irq_parse_and_map_pci;
8382
bridge->swizzle_irq = pci_common_swizzle;

drivers/pci/controller/pci-tegra.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,7 +2668,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
26682668
struct device *dev = &pdev->dev;
26692669
struct pci_host_bridge *host;
26702670
struct tegra_pcie *pcie;
2671-
struct resource *bus;
26722671
int err;
26732672

26742673
host = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
@@ -2683,7 +2682,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
26832682
INIT_LIST_HEAD(&pcie->ports);
26842683
pcie->dev = dev;
26852684

2686-
err = pci_parse_request_of_pci_ranges(dev, &host->windows, NULL, &bus);
2685+
err = pci_parse_request_of_pci_ranges(dev, &host->windows, NULL, NULL);
26872686
if (err) {
26882687
dev_err(dev, "Getting bridge resources failed\n");
26892688
return err;
@@ -2712,7 +2711,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
27122711
goto pm_runtime_put;
27132712
}
27142713

2715-
host->busnr = bus->start;
27162714
host->ops = &tegra_pcie_ops;
27172715
host->map_irq = tegra_pcie_map_irq;
27182716
host->swizzle_irq = pci_common_swizzle;

drivers/pci/controller/pci-v3-semi.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,6 @@ static int v3_pci_setup_resource(struct v3_pci *v3,
584584
}
585585
break;
586586
case IORESOURCE_BUS:
587-
dev_dbg(dev, "BUS %pR\n", win->res);
588-
host->busnr = win->res->start;
589587
break;
590588
default:
591589
dev_info(dev, "Unknown resource type %lu\n",

drivers/pci/controller/pcie-mediatek.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ struct mtk_pcie_port {
209209
* @mem: non-prefetchable memory resource
210210
* @ports: pointer to PCIe port information
211211
* @soc: pointer to SoC-dependent operations
212-
* @busnr: root bus number
213212
*/
214213
struct mtk_pcie {
215214
struct device *dev;
@@ -218,7 +217,6 @@ struct mtk_pcie {
218217

219218
struct list_head ports;
220219
const struct mtk_pcie_soc *soc;
221-
unsigned int busnr;
222220
};
223221

224222
static void mtk_pcie_subsys_powerdown(struct mtk_pcie *pcie)
@@ -1031,16 +1029,13 @@ static int mtk_pcie_setup(struct mtk_pcie *pcie)
10311029
struct mtk_pcie_port *port, *tmp;
10321030
struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie);
10331031
struct list_head *windows = &host->windows;
1034-
struct resource *bus;
10351032
int err;
10361033

10371034
err = pci_parse_request_of_pci_ranges(dev, windows,
1038-
&host->dma_ranges, &bus);
1035+
&host->dma_ranges, NULL);
10391036
if (err)
10401037
return err;
10411038

1042-
pcie->busnr = bus->start;
1043-
10441039
for_each_available_child_of_node(node, child) {
10451040
int slot;
10461041

@@ -1094,7 +1089,6 @@ static int mtk_pcie_probe(struct platform_device *pdev)
10941089
if (err)
10951090
return err;
10961091

1097-
host->busnr = pcie->busnr;
10981092
host->ops = pcie->soc->ops;
10991093
host->map_irq = of_irq_parse_and_map_pci;
11001094
host->swizzle_irq = pci_common_swizzle;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ static int rcar_pcie_setup(struct list_head *resource,
224224
i++;
225225
break;
226226
case IORESOURCE_BUS:
227-
bridge->busnr = res->start;
228227
break;
229228
default:
230229
continue;

drivers/pci/probe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,6 +3088,7 @@ int pci_scan_root_bus_bridge(struct pci_host_bridge *bridge)
30883088

30893089
resource_list_for_each_entry(window, &bridge->windows)
30903090
if (window->res->flags & IORESOURCE_BUS) {
3091+
bridge->busnr = window->res->start;
30913092
found = true;
30923093
break;
30933094
}

0 commit comments

Comments
 (0)