Commit 6a589900 authored by Rob Herring's avatar Rob Herring Committed by Lorenzo Pieralisi

PCI: Set default bridge parent device

The host bridge's parent device is always the platform device. As we
already have a pointer to it in the devres functions, let's initialize
the parent device. Drivers can still override the parent if desired.

Link: https://lore.kernel.org/r/20200722022514.1283916-3-robh@kernel.orgSigned-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 79cbde56
...@@ -241,7 +241,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc) ...@@ -241,7 +241,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
if (ret) if (ret)
goto err_init; goto err_init;
bridge->dev.parent = dev;
bridge->busnr = pcie->bus; bridge->busnr = pcie->bus;
bridge->ops = &cdns_pcie_host_ops; bridge->ops = &cdns_pcie_host_ops;
bridge->map_irq = of_irq_parse_and_map_pci; bridge->map_irq = of_irq_parse_and_map_pci;
......
...@@ -475,7 +475,6 @@ int dw_pcie_host_init(struct pcie_port *pp) ...@@ -475,7 +475,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->root_bus_nr = pp->busn->start; pp->root_bus_nr = pp->busn->start;
bridge->dev.parent = dev;
bridge->sysdata = pp; bridge->sysdata = pp;
bridge->busnr = pp->root_bus_nr; bridge->busnr = pp->root_bus_nr;
bridge->ops = &dw_pcie_ops; bridge->ops = &dw_pcie_ops;
......
...@@ -605,7 +605,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie) ...@@ -605,7 +605,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
} }
/* Initialize bridge */ /* Initialize bridge */
bridge->dev.parent = dev;
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = rp->root_bus_nr; bridge->busnr = rp->root_bus_nr;
bridge->ops = &mobiveil_pcie_ops; bridge->ops = &mobiveil_pcie_ops;
......
...@@ -1183,7 +1183,6 @@ static int advk_pcie_probe(struct platform_device *pdev) ...@@ -1183,7 +1183,6 @@ static int advk_pcie_probe(struct platform_device *pdev)
return ret; return ret;
} }
bridge->dev.parent = dev;
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &advk_pcie_ops; bridge->ops = &advk_pcie_ops;
......
...@@ -436,7 +436,6 @@ static int faraday_pci_probe(struct platform_device *pdev) ...@@ -436,7 +436,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
if (!host) if (!host)
return -ENOMEM; return -ENOMEM;
host->dev.parent = dev;
host->ops = &faraday_pci_ops; host->ops = &faraday_pci_ops;
host->busnr = 0; host->busnr = 0;
host->msi = NULL; host->msi = NULL;
......
...@@ -76,7 +76,6 @@ int pci_host_common_probe(struct platform_device *pdev) ...@@ -76,7 +76,6 @@ int pci_host_common_probe(struct platform_device *pdev)
if (!pci_has_flag(PCI_PROBE_ONLY)) if (!pci_has_flag(PCI_PROBE_ONLY))
pci_add_flags(PCI_REASSIGN_ALL_BUS); pci_add_flags(PCI_REASSIGN_ALL_BUS);
bridge->dev.parent = dev;
bridge->sysdata = cfg; bridge->sysdata = cfg;
bridge->busnr = cfg->busr.start; bridge->busnr = cfg->busr.start;
bridge->ops = (struct pci_ops *)&ops->pci_ops; bridge->ops = (struct pci_ops *)&ops->pci_ops;
......
...@@ -225,7 +225,6 @@ static int loongson_pci_probe(struct platform_device *pdev) ...@@ -225,7 +225,6 @@ static int loongson_pci_probe(struct platform_device *pdev)
return err; return err;
} }
bridge->dev.parent = dev;
bridge->sysdata = priv; bridge->sysdata = priv;
bridge->ops = &loongson_pci_ops; bridge->ops = &loongson_pci_ops;
bridge->map_irq = loongson_map_irq; bridge->map_irq = loongson_map_irq;
......
...@@ -1116,7 +1116,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev) ...@@ -1116,7 +1116,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
pcie->nports = i; pcie->nports = i;
bridge->dev.parent = dev;
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &mvebu_pcie_ops; bridge->ops = &mvebu_pcie_ops;
......
...@@ -2713,7 +2713,6 @@ static int tegra_pcie_probe(struct platform_device *pdev) ...@@ -2713,7 +2713,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
} }
host->busnr = bus->start; host->busnr = bus->start;
host->dev.parent = &pdev->dev;
host->ops = &tegra_pcie_ops; host->ops = &tegra_pcie_ops;
host->map_irq = tegra_pcie_map_irq; host->map_irq = tegra_pcie_map_irq;
host->swizzle_irq = pci_common_swizzle; host->swizzle_irq = pci_common_swizzle;
......
...@@ -723,7 +723,6 @@ static int v3_pci_probe(struct platform_device *pdev) ...@@ -723,7 +723,6 @@ static int v3_pci_probe(struct platform_device *pdev)
if (!host) if (!host)
return -ENOMEM; return -ENOMEM;
host->dev.parent = dev;
host->ops = &v3_pci_ops; host->ops = &v3_pci_ops;
host->busnr = 0; host->busnr = 0;
host->msi = NULL; host->msi = NULL;
......
...@@ -153,7 +153,6 @@ static int versatile_pci_probe(struct platform_device *pdev) ...@@ -153,7 +153,6 @@ static int versatile_pci_probe(struct platform_device *pdev)
pci_add_flags(PCI_REASSIGN_ALL_BUS); pci_add_flags(PCI_REASSIGN_ALL_BUS);
bridge->dev.parent = dev;
bridge->sysdata = NULL; bridge->sysdata = NULL;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &pci_versatile_ops; bridge->ops = &pci_versatile_ops;
......
...@@ -623,7 +623,6 @@ static int xgene_pcie_probe(struct platform_device *pdev) ...@@ -623,7 +623,6 @@ static int xgene_pcie_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
bridge->dev.parent = dev;
bridge->sysdata = port; bridge->sysdata = port;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &xgene_pcie_ops; bridge->ops = &xgene_pcie_ops;
......
...@@ -813,7 +813,6 @@ static int altera_pcie_probe(struct platform_device *pdev) ...@@ -813,7 +813,6 @@ static int altera_pcie_probe(struct platform_device *pdev)
cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE); cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE);
altera_pcie_host_init(pcie); altera_pcie_host_init(pcie);
bridge->dev.parent = dev;
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = pcie->root_bus_nr; bridge->busnr = pcie->root_bus_nr;
bridge->ops = &altera_pcie_ops; bridge->ops = &altera_pcie_ops;
......
...@@ -994,7 +994,6 @@ static int brcm_pcie_probe(struct platform_device *pdev) ...@@ -994,7 +994,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
} }
} }
bridge->dev.parent = &pdev->dev;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &brcm_pcie_ops; bridge->ops = &brcm_pcie_ops;
bridge->sysdata = pcie; bridge->sysdata = pcie;
......
...@@ -1524,7 +1524,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) ...@@ -1524,7 +1524,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
dev_info(dev, "not using iProc MSI\n"); dev_info(dev, "not using iProc MSI\n");
host->busnr = 0; host->busnr = 0;
host->dev.parent = dev;
host->ops = &iproc_pcie_ops; host->ops = &iproc_pcie_ops;
host->sysdata = pcie; host->sysdata = pcie;
host->map_irq = pcie->map_irq; host->map_irq = pcie->map_irq;
......
...@@ -1095,7 +1095,6 @@ static int mtk_pcie_probe(struct platform_device *pdev) ...@@ -1095,7 +1095,6 @@ static int mtk_pcie_probe(struct platform_device *pdev)
return err; return err;
host->busnr = pcie->busnr; host->busnr = pcie->busnr;
host->dev.parent = pcie->dev;
host->ops = pcie->soc->ops; host->ops = pcie->soc->ops;
host->map_irq = of_irq_parse_and_map_pci; host->map_irq = of_irq_parse_and_map_pci;
host->swizzle_irq = pci_common_swizzle; host->swizzle_irq = pci_common_swizzle;
......
...@@ -329,7 +329,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host) ...@@ -329,7 +329,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
{ {
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(host);
struct rcar_pcie *pcie = &host->pcie; struct rcar_pcie *pcie = &host->pcie;
struct device *dev = pcie->dev;
/* Try setting 5 GT/s link speed */ /* Try setting 5 GT/s link speed */
rcar_pcie_force_speedup(pcie); rcar_pcie_force_speedup(pcie);
...@@ -338,7 +337,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host) ...@@ -338,7 +337,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
pci_add_flags(PCI_REASSIGN_ALL_BUS); pci_add_flags(PCI_REASSIGN_ALL_BUS);
bridge->dev.parent = dev;
bridge->sysdata = host; bridge->sysdata = host;
bridge->busnr = host->root_bus_nr; bridge->busnr = host->root_bus_nr;
bridge->ops = &rcar_pcie_ops; bridge->ops = &rcar_pcie_ops;
......
...@@ -1007,7 +1007,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev) ...@@ -1007,7 +1007,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
goto err_remove_irq_domain; goto err_remove_irq_domain;
} }
bridge->dev.parent = dev;
bridge->sysdata = rockchip; bridge->sysdata = rockchip;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &rockchip_pcie_ops; bridge->ops = &rockchip_pcie_ops;
......
...@@ -854,7 +854,6 @@ static int nwl_pcie_probe(struct platform_device *pdev) ...@@ -854,7 +854,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
return err; return err;
} }
bridge->dev.parent = dev;
bridge->sysdata = pcie; bridge->sysdata = pcie;
bridge->busnr = pcie->root_busno; bridge->busnr = pcie->root_busno;
bridge->ops = &nwl_pcie_ops; bridge->ops = &nwl_pcie_ops;
......
...@@ -651,7 +651,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev) ...@@ -651,7 +651,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
return err; return err;
} }
bridge->dev.parent = dev;
bridge->sysdata = port; bridge->sysdata = port;
bridge->busnr = 0; bridge->busnr = 0;
bridge->ops = &xilinx_pcie_ops; bridge->ops = &xilinx_pcie_ops;
......
...@@ -628,6 +628,8 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev, ...@@ -628,6 +628,8 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev,
if (!bridge) if (!bridge)
return NULL; return NULL;
bridge->dev.parent = dev;
ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release, ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release,
bridge); bridge);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment