diff mbox series

cpuidle: qcom_spm: make driver multi-arch friendly

Message ID 20211020120643.28231-1-m.szyprowski@samsung.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series cpuidle: qcom_spm: make driver multi-arch friendly | expand

Commit Message

Marek Szyprowski Oct. 20, 2021, 12:06 p.m. UTC
Avoid returning -EPROBE_DEFER from spm_cpuidle_drv_probe() on non-qcom
based systems. This makes the driver multi-arch friendly again after
commit 60f3692b5f0b ("cpuidle: qcom_spm: Detach state machine from main
SPM handling").

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
This fixes the issue I've reported some time ago:
https://lore.kernel.org/all/86e3e09f-a8d7-3dff-3fc6-ddd7d30c5d78@samsung.com/
---
 drivers/cpuidle/cpuidle-qcom-spm.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c
index 01e77913a414..1ee056fdfbb8 100644
--- a/drivers/cpuidle/cpuidle-qcom-spm.c
+++ b/drivers/cpuidle/cpuidle-qcom-spm.c
@@ -129,12 +129,26 @@  static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
 	return cpuidle_register(&data->cpuidle_driver, NULL);
 }
 
+static int spm_dev_check(struct device_driver *drv, void *data)
+{
+	if (strcmp(drv->name, "qcom_spm") == 0) {
+		struct device_node *np;
+
+		np = of_find_matching_node(NULL, drv->of_match_table);
+		if (np) {
+			of_node_put(np);
+			return -EPROBE_DEFER;
+		}
+	}
+	return -ENODEV;
+}
+
 static int spm_cpuidle_drv_probe(struct platform_device *pdev)
 {
 	int cpu, ret;
 
 	if (!qcom_scm_is_available())
-		return -EPROBE_DEFER;
+		return bus_for_each_drv(pdev->dev.bus, NULL, NULL, spm_dev_check);
 
 	for_each_possible_cpu(cpu) {
 		ret = spm_cpuidle_register(&pdev->dev, cpu);