From c296f63fe3a0d8166a3af4560b088a9aec194b08 Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Thu, 21 Jan 2021 15:24:22 +0800 Subject: [PATCH] PCI: rockchip: dw: Fix unblance pm call for fake probe We move all the probe stuff to kthread so that it won't block the system to go on probing other drivers. But that introduced it bug that PM calls would not be removed by driver core. We trace back the platform driver to add PM callbacks if we really detect active devices. Fixes: 79ac46bdea6b ("PCI: rockchip: dw: Add kthread to probe PCIe devices") Change-Id: I93a331fe6c17d97b71010780fba4afbc2dbf6216 Signed-off-by: Shawn Lin --- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index 24169e1ce16e..93322628c7fc 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -140,6 +140,7 @@ struct rk_pcie_of_data { }; #define to_rk_pcie(x) dev_get_drvdata((x)->dev) +static const struct dev_pm_ops rockchip_dw_pcie_pm_ops; static int rk_pcie_read(void __iomem *addr, int size, u32 *val) { @@ -1114,6 +1115,7 @@ static int rk_pcie_really_probe(void *p) const struct rk_pcie_of_data *data; enum rk_pcie_device_mode mode; struct device_node *np = pdev->dev.of_node; + struct platform_driver *drv = to_platform_driver(dev->driver); u32 val; match = of_match_device(rk_pcie_of_match, dev); @@ -1253,6 +1255,7 @@ static int rk_pcie_really_probe(void *p) dw_pcie_dbi_ro_wr_dis(pci); device_init_wakeup(dev, true); + drv->driver.pm = &rockchip_dw_pcie_pm_ops; return 0; @@ -1403,7 +1406,6 @@ static struct platform_driver rk_plat_pcie_driver = { .name = "rk-pcie", .of_match_table = rk_pcie_of_match, .suppress_bind_attrs = true, - .pm = &rockchip_dw_pcie_pm_ops, }, };