qcom-cpufreq: Register cpufreq driver in driver probe
We don't handle probe defer very well in this driver. If the platform_driver_register() call doesn't immediately probe the driver there, or if that driver probe defers for some reason, then the cpufreq driver registration in msm_cpufreq_register() will fail due to a missing frequency table. Let's move the cpufreq driver registration (and platform suspend hook part) into the platform driver probe path, so we handle probe defer properly and avoid any issues with order of initializations. Change-Id: I14b514d46239f52b535563d49fb5c19d06072c3a Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Rohit Gupta <rohgup@codeaurora.org> Signed-off-by: Jonathan Avila <avilaj@codeaurora.org>
This commit is contained in:
committed by
Jonathan Avila
parent
f31cedbcb4
commit
d9d6c80975
@@ -343,7 +343,7 @@ static int msm_cpufreq_probe(struct platform_device *pdev)
|
||||
char clk_name[] = "cpu??_clk";
|
||||
char tbl_name[] = "qcom,cpufreq-table-??";
|
||||
struct clk *c;
|
||||
int cpu;
|
||||
int cpu, ret;
|
||||
struct cpufreq_frequency_table *ftbl;
|
||||
|
||||
l2_clk = devm_clk_get(dev, "l2_clk");
|
||||
@@ -410,7 +410,15 @@ static int msm_cpufreq_probe(struct platform_device *pdev)
|
||||
per_cpu(freq_table, cpu) = ftbl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
ret = register_pm_notifier(&msm_cpufreq_pm_notifier);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = cpufreq_register_driver(&msm_cpufreq_driver);
|
||||
if (ret)
|
||||
unregister_pm_notifier(&msm_cpufreq_pm_notifier);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id msm_cpufreq_match_table[] = {
|
||||
@@ -446,8 +454,7 @@ static int __init msm_cpufreq_register(void)
|
||||
return rc;
|
||||
}
|
||||
|
||||
register_pm_notifier(&msm_cpufreq_pm_notifier);
|
||||
return cpufreq_register_driver(&msm_cpufreq_driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
subsys_initcall(msm_cpufreq_register);
|
||||
|
||||
Reference in New Issue
Block a user