Skip to content

Commit e259c29

Browse files
committed
PCI: pci-dra7xx: Prepare for deferred probe with module_platform_driver
After updating pci-dra7xx driver to probe with ti-sysc and genpd, I noticed that dra7xx_pcie_probe() would not run if a power-domains property was configured for the interconnect target module. Turns out that module_platform_driver_probe uses platform_driver_probe(), while builtin_platform_driver uses platform_driver_register(). Only platform_driver_register() works for deferred probe as noted in the comments for __platform_driver_probe() in drivers/base/platform.c with a line saying "Note that this is incompatible with deferred probing". With module_platform_driver_probe, we have platform_driver_probe() produce -ENODEV error at device_initcall() level, and no further attempts are done. Let's fix this by using module_platform_driver instead. Note this is not an issue currently as we probe devices with simple-bus, and only is needed as we start probing the device with ti-sysc, or when probed with simple-pm-bus. Note that we must now also remove __init for probe related functions to avoid a section mismatch warning. Cc: [email protected] Cc: Bjorn Helgaas <[email protected]> Cc: Lorenzo Pieralisi <[email protected]> Tested-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent 7f7acef commit e259c29

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/pci/controller/dwc/pci-dra7xx.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ static const struct dw_pcie_ep_ops pcie_ep_ops = {
443443
.get_features = dra7xx_pcie_get_features,
444444
};
445445

446-
static int __init dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx,
447-
struct platform_device *pdev)
446+
static int dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx,
447+
struct platform_device *pdev)
448448
{
449449
int ret;
450450
struct dw_pcie_ep *ep;
@@ -472,8 +472,8 @@ static int __init dra7xx_add_pcie_ep(struct dra7xx_pcie *dra7xx,
472472
return 0;
473473
}
474474

475-
static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
476-
struct platform_device *pdev)
475+
static int dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,
476+
struct platform_device *pdev)
477477
{
478478
int ret;
479479
struct dw_pcie *pci = dra7xx->pci;
@@ -682,7 +682,7 @@ static int dra7xx_pcie_configure_two_lane(struct device *dev,
682682
return 0;
683683
}
684684

685-
static int __init dra7xx_pcie_probe(struct platform_device *pdev)
685+
static int dra7xx_pcie_probe(struct platform_device *pdev)
686686
{
687687
u32 reg;
688688
int ret;
@@ -938,6 +938,7 @@ static const struct dev_pm_ops dra7xx_pcie_pm_ops = {
938938
};
939939

940940
static struct platform_driver dra7xx_pcie_driver = {
941+
.probe = dra7xx_pcie_probe,
941942
.driver = {
942943
.name = "dra7-pcie",
943944
.of_match_table = of_dra7xx_pcie_match,
@@ -946,4 +947,4 @@ static struct platform_driver dra7xx_pcie_driver = {
946947
},
947948
.shutdown = dra7xx_pcie_shutdown,
948949
};
949-
builtin_platform_driver_probe(dra7xx_pcie_driver, dra7xx_pcie_probe);
950+
builtin_platform_driver(dra7xx_pcie_driver);

0 commit comments

Comments
 (0)