[PATCH 3/4] perf/dwc_pcie: Always register for PCIe bus notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the PCIe devices are discovered late, the driver can't find
the PCIe devices and returns in the init without registering with
the bus notifier. Due to that the devices which are discovered late
the driver can't register for this.

Register for bus notifier even if the device is not found in init.

Fixes: af9597adc2f1 ("drivers/perf: add DesignWare PCIe PMU driver")
Signed-off-by: Krishna chaitanya chundru <quic_krichai@xxxxxxxxxxx>
---
 drivers/perf/dwc_pcie_pmu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c
index c115348b8d53..aa1010b44bcb 100644
--- a/drivers/perf/dwc_pcie_pmu.c
+++ b/drivers/perf/dwc_pcie_pmu.c
@@ -741,8 +741,6 @@ static int __init dwc_pcie_pmu_init(void)
 
 		found = true;
 	}
-	if (!found)
-		return -ENODEV;
 
 	ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
 				      "perf/dwc_pcie_pmu:online",
@@ -753,9 +751,11 @@ static int __init dwc_pcie_pmu_init(void)
 
 	dwc_pcie_pmu_hp_state = ret;
 
-	ret = platform_driver_register(&dwc_pcie_pmu_driver);
-	if (ret)
-		goto platform_driver_register_err;
+	if (!found) {
+		ret = platform_driver_register(&dwc_pcie_pmu_driver);
+		if (ret)
+			goto platform_driver_register_err;
+	}
 
 	ret = bus_register_notifier(&pci_bus_type, &dwc_pcie_pmu_nb);
 	if (ret)

-- 
2.34.1





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux