diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-11-25 05:34:23 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-11-30 20:49:33 -0500 |
commit | cc87b8a8e94d840863334151f3525fd286c9ae23 (patch) | |
tree | eaa7f97b46b755c0f7bfd406f9c057f5008ba427 | |
parent | c6104fdbb2f83ad7696220e14fee54e14935f04b (diff) |
imx6q: free OPP table created during ->init()
OPP layer now supports freeing of OPPs and we should free them once they aren't
useful anymore.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/cpufreq/imx6q-cpufreq.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index c2d30765bf3d..5da1d131f770 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c | |||
@@ -31,6 +31,7 @@ static struct clk *step_clk; | |||
31 | static struct clk *pll2_pfd2_396m_clk; | 31 | static struct clk *pll2_pfd2_396m_clk; |
32 | 32 | ||
33 | static struct device *cpu_dev; | 33 | static struct device *cpu_dev; |
34 | static bool free_opp; | ||
34 | static struct cpufreq_frequency_table *freq_table; | 35 | static struct cpufreq_frequency_table *freq_table; |
35 | static unsigned int transition_latency; | 36 | static unsigned int transition_latency; |
36 | 37 | ||
@@ -207,11 +208,14 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) | |||
207 | goto put_reg; | 208 | goto put_reg; |
208 | } | 209 | } |
209 | 210 | ||
211 | /* Because we have added the OPPs here, we must free them */ | ||
212 | free_opp = true; | ||
213 | |||
210 | num = dev_pm_opp_get_opp_count(cpu_dev); | 214 | num = dev_pm_opp_get_opp_count(cpu_dev); |
211 | if (num < 0) { | 215 | if (num < 0) { |
212 | ret = num; | 216 | ret = num; |
213 | dev_err(cpu_dev, "no OPP table is found: %d\n", ret); | 217 | dev_err(cpu_dev, "no OPP table is found: %d\n", ret); |
214 | goto put_reg; | 218 | goto out_free_opp; |
215 | } | 219 | } |
216 | } | 220 | } |
217 | 221 | ||
@@ -306,6 +310,9 @@ soc_opp_out: | |||
306 | 310 | ||
307 | free_freq_table: | 311 | free_freq_table: |
308 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); | 312 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
313 | out_free_opp: | ||
314 | if (free_opp) | ||
315 | of_free_opp_table(cpu_dev); | ||
309 | put_reg: | 316 | put_reg: |
310 | if (!IS_ERR(arm_reg)) | 317 | if (!IS_ERR(arm_reg)) |
311 | regulator_put(arm_reg); | 318 | regulator_put(arm_reg); |
@@ -332,6 +339,8 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) | |||
332 | { | 339 | { |
333 | cpufreq_unregister_driver(&imx6q_cpufreq_driver); | 340 | cpufreq_unregister_driver(&imx6q_cpufreq_driver); |
334 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); | 341 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
342 | if (free_opp) | ||
343 | of_free_opp_table(cpu_dev); | ||
335 | regulator_put(arm_reg); | 344 | regulator_put(arm_reg); |
336 | if (!IS_ERR(pu_reg)) | 345 | if (!IS_ERR(pu_reg)) |
337 | regulator_put(pu_reg); | 346 | regulator_put(pu_reg); |