PCI: Set default bridge parent device
authorRob Herring <robh@kernel.org>
Wed, 22 Jul 2020 02:24:57 +0000 (20:24 -0600)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 23 Jul 2020 10:20:49 +0000 (11:20 +0100)
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.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
21 files changed:
drivers/pci/controller/cadence/pcie-cadence-host.c
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
drivers/pci/controller/pci-aardvark.c
drivers/pci/controller/pci-ftpci100.c
drivers/pci/controller/pci-host-common.c
drivers/pci/controller/pci-loongson.c
drivers/pci/controller/pci-mvebu.c
drivers/pci/controller/pci-tegra.c
drivers/pci/controller/pci-v3-semi.c
drivers/pci/controller/pci-versatile.c
drivers/pci/controller/pci-xgene.c
drivers/pci/controller/pcie-altera.c
drivers/pci/controller/pcie-brcmstb.c
drivers/pci/controller/pcie-iproc.c
drivers/pci/controller/pcie-mediatek.c
drivers/pci/controller/pcie-rcar-host.c
drivers/pci/controller/pcie-rockchip-host.c
drivers/pci/controller/pcie-xilinx-nwl.c
drivers/pci/controller/pcie-xilinx.c
drivers/pci/probe.c

index 8809beb51d0404b954940c1ee8c252d2ed35cdeb..ec41c6d6e4fac0581eadd07aff5a2c58d0eb4fe7 100644 (file)
@@ -241,7 +241,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
        if (ret)
                goto err_init;
 
-       bridge->dev.parent = dev;
        bridge->busnr = pcie->bus;
        bridge->ops = &cdns_pcie_host_ops;
        bridge->map_irq = of_irq_parse_and_map_pci;
index 0a4a5aa6fe46918b5d957f83ab8d7cb30b9f27a5..4a16306cec257481f8497a99694a0fe9900ff13b 100644 (file)
@@ -475,7 +475,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
 
        pp->root_bus_nr = pp->busn->start;
 
-       bridge->dev.parent = dev;
        bridge->sysdata = pp;
        bridge->busnr = pp->root_bus_nr;
        bridge->ops = &dw_pcie_ops;
index 5974619811ec2a393e6e6f4560076118fc871082..705542b4bd210d5c44b3be9616398195828bec8a 100644 (file)
@@ -605,7 +605,6 @@ int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
        }
 
        /* Initialize bridge */
-       bridge->dev.parent = dev;
        bridge->sysdata = pcie;
        bridge->busnr = rp->root_bus_nr;
        bridge->ops = &mobiveil_pcie_ops;
index 0d98f9b04daac7788177f93904fa277c7fd5c747..6aaa6ed0438cba6f96973387c4f4adf072d50731 100644 (file)
@@ -1183,7 +1183,6 @@ static int advk_pcie_probe(struct platform_device *pdev)
                return ret;
        }
 
-       bridge->dev.parent = dev;
        bridge->sysdata = pcie;
        bridge->busnr = 0;
        bridge->ops = &advk_pcie_ops;
index 221dfc9dc81b871584bd8e708bb026e813d6670f..db887cbbec093df80acb87def8b6b94286e89eaa 100644 (file)
@@ -436,7 +436,6 @@ static int faraday_pci_probe(struct platform_device *pdev)
        if (!host)
                return -ENOMEM;
 
-       host->dev.parent = dev;
        host->ops = &faraday_pci_ops;
        host->busnr = 0;
        host->msi = NULL;
index b76e55f495e47b77fc147c3894f42101a9212891..ad395d7feddc52ee311e387ab21a609b60b45ece 100644 (file)
@@ -76,7 +76,6 @@ int pci_host_common_probe(struct platform_device *pdev)
        if (!pci_has_flag(PCI_PROBE_ONLY))
                pci_add_flags(PCI_REASSIGN_ALL_BUS);
 
-       bridge->dev.parent = dev;
        bridge->sysdata = cfg;
        bridge->busnr = cfg->busr.start;
        bridge->ops = (struct pci_ops *)&ops->pci_ops;
index 459009c8a4a02b7b2b88dfdc4c550a924164ed59..0198c15ed97c512bd3f9c19aed58cfcf2c19e8c8 100644 (file)
@@ -225,7 +225,6 @@ static int loongson_pci_probe(struct platform_device *pdev)
                return err;
        }
 
-       bridge->dev.parent = dev;
        bridge->sysdata = priv;
        bridge->ops = &loongson_pci_ops;
        bridge->map_irq = loongson_map_irq;
index 801044523a3d1597af460d233fdb9a74bb1cf515..7be6db851614aec02266f22e03ac284c298658dd 100644 (file)
@@ -1116,7 +1116,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 
        pcie->nports = i;
 
-       bridge->dev.parent = dev;
        bridge->sysdata = pcie;
        bridge->busnr = 0;
        bridge->ops = &mvebu_pcie_ops;
index 71bf4b2684ac2a1c8f63238c8c5be47bac159a00..41232bd07c3d1e5a9a24d67f8fb9f833b50e91cf 100644 (file)
@@ -2713,7 +2713,6 @@ static int tegra_pcie_probe(struct platform_device *pdev)
        }
 
        host->busnr = bus->start;
-       host->dev.parent = &pdev->dev;
        host->ops = &tegra_pcie_ops;
        host->map_irq = tegra_pcie_map_irq;
        host->swizzle_irq = pci_common_swizzle;
index 198cf2c6ed924a271eb336bc0995834f3261c075..e8b5e55803b2ad1cd548633f806d511be2e89b76 100644 (file)
@@ -723,7 +723,6 @@ static int v3_pci_probe(struct platform_device *pdev)
        if (!host)
                return -ENOMEM;
 
-       host->dev.parent = dev;
        host->ops = &v3_pci_ops;
        host->busnr = 0;
        host->msi = NULL;
index 39ed7a171fac8e82eeaa5229e46966414e2c1a68..ea1889cad72278811b3ae1b3a6ec665baf6b90d8 100644 (file)
@@ -153,7 +153,6 @@ static int versatile_pci_probe(struct platform_device *pdev)
 
        pci_add_flags(PCI_REASSIGN_ALL_BUS);
 
-       bridge->dev.parent = dev;
        bridge->sysdata = NULL;
        bridge->busnr = 0;
        bridge->ops = &pci_versatile_ops;
index 4c783cfddb3a62549e490facd2c175aa60fafabb..f02cbd65b8b3f418f7c9a678de88d64737a4a1dd 100644 (file)
@@ -623,7 +623,6 @@ static int xgene_pcie_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       bridge->dev.parent = dev;
        bridge->sysdata = port;
        bridge->busnr = 0;
        bridge->ops = &xgene_pcie_ops;
index 4ffe382f220f32cd8ae4be862193ff0240506882..4424430dacb07873f7b2cfffb54c5f0165ffd908 100644 (file)
@@ -813,7 +813,6 @@ static int altera_pcie_probe(struct platform_device *pdev)
        cra_writel(pcie, P2A_INT_ENA_ALL, P2A_INT_ENABLE);
        altera_pcie_host_init(pcie);
 
-       bridge->dev.parent = dev;
        bridge->sysdata = pcie;
        bridge->busnr = pcie->root_bus_nr;
        bridge->ops = &altera_pcie_ops;
index 91a4b7f3ee45fb41b8bdc81a7110a78607d86e6c..87e9695e2afa37487fce51ebf21916eab359dbfa 100644 (file)
@@ -994,7 +994,6 @@ static int brcm_pcie_probe(struct platform_device *pdev)
                }
        }
 
-       bridge->dev.parent = &pdev->dev;
        bridge->busnr = 0;
        bridge->ops = &brcm_pcie_ops;
        bridge->sysdata = pcie;
index 232fca0754e152276118a46198a72d0cc2b3bac6..cf1cb717c7df8fe9b5fd27e08f05d0b43a44a3fd 100644 (file)
@@ -1524,7 +1524,6 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res)
                        dev_info(dev, "not using iProc MSI\n");
 
        host->busnr = 0;
-       host->dev.parent = dev;
        host->ops = &iproc_pcie_ops;
        host->sysdata = pcie;
        host->map_irq = pcie->map_irq;
index d8e38276dbe340b7c7c096a08ff20bec3f26b069..a9399b8d2e8b4863cb192c168a43f9d883a8d69b 100644 (file)
@@ -1095,7 +1095,6 @@ static int mtk_pcie_probe(struct platform_device *pdev)
                return err;
 
        host->busnr = pcie->busnr;
-       host->dev.parent = pcie->dev;
        host->ops = pcie->soc->ops;
        host->map_irq = of_irq_parse_and_map_pci;
        host->swizzle_irq = pci_common_swizzle;
index 9069ad96fe95c1abfe150bddcc7ad43df7cb6749..3a8e749b4904b5643b5a2d54286c0c8fd1f68404 100644 (file)
@@ -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 rcar_pcie *pcie = &host->pcie;
-       struct device *dev = pcie->dev;
 
        /* Try setting 5 GT/s link speed */
        rcar_pcie_force_speedup(pcie);
@@ -338,7 +337,6 @@ static int rcar_pcie_enable(struct rcar_pcie_host *host)
 
        pci_add_flags(PCI_REASSIGN_ALL_BUS);
 
-       bridge->dev.parent = dev;
        bridge->sysdata = host;
        bridge->busnr = host->root_bus_nr;
        bridge->ops = &rcar_pcie_ops;
index 6a3c8442258b9eded70e440d3af549b268a5e285..4eb79c60d627f97b95e4a0d020b6c867cc8bea9f 100644 (file)
@@ -1007,7 +1007,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
                goto err_remove_irq_domain;
        }
 
-       bridge->dev.parent = dev;
        bridge->sysdata = rockchip;
        bridge->busnr = 0;
        bridge->ops = &rockchip_pcie_ops;
index 32a0b08d6da5f1f9b7f8901ebd94df54c04ff0ba..3c747aa4b6d1991f2e002ba274a6e581e1471642 100644 (file)
@@ -854,7 +854,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
                return err;
        }
 
-       bridge->dev.parent = dev;
        bridge->sysdata = pcie;
        bridge->busnr = pcie->root_busno;
        bridge->ops = &nwl_pcie_ops;
index 05547497f391dbfadc6232a35ff58795703238bc..7c0f3268fc5c19fd311900ebee9dd779f42d54db 100644 (file)
@@ -651,7 +651,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
                return err;
        }
 
-       bridge->dev.parent = dev;
        bridge->sysdata = port;
        bridge->busnr = 0;
        bridge->ops = &xilinx_pcie_ops;
index 2f66988cea25756e7c93caa7b8da022cb98c0396..5583037dbdfab566627e3f9aea5a932c4e4fe84f 100644 (file)
@@ -628,6 +628,8 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev,
        if (!bridge)
                return NULL;
 
+       bridge->dev.parent = dev;
+
        ret = devm_add_action_or_reset(dev, devm_pci_alloc_host_bridge_release,
                                       bridge);
        if (ret)