Commit 62a041a4f58f32989460e37cb4f9aed5183f357f
Committed by
Rafael J. Wysocki
1 parent
437574c9cb
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
cpufreq-dt: defer probing if OPP table is not ready
cpufreq-dt driver supports mode when OPP table is provided by platform code and not device tree. However on certain platforms code that fills OPP table may run after cpufreq driver tries to initialize, so let's report -EPROBE_DEFER if we do not find any entires in OPP table for the CPU. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Showing 1 changed file with 11 additions and 0 deletions Side-by-side Diff
drivers/cpufreq/cpufreq-dt.c
... | ... | @@ -211,6 +211,17 @@ |
211 | 211 | /* OPPs might be populated at runtime, don't check for error here */ |
212 | 212 | of_init_opp_table(cpu_dev); |
213 | 213 | |
214 | + /* | |
215 | + * But we need OPP table to function so if it is not there let's | |
216 | + * give platform code chance to provide it for us. | |
217 | + */ | |
218 | + ret = dev_pm_opp_get_opp_count(cpu_dev); | |
219 | + if (ret <= 0) { | |
220 | + pr_debug("OPP table is not ready, deferring probe\n"); | |
221 | + ret = -EPROBE_DEFER; | |
222 | + goto out_free_opp; | |
223 | + } | |
224 | + | |
214 | 225 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
215 | 226 | if (!priv) { |
216 | 227 | ret = -ENOMEM; |