Almost all drivers set policy->cur with current cpu frequency in their ->init() part. This can be done for all of them at core level and so they wouldn't need to do it.
This patch adds supporting code in cpufreq core for calling get() after we have called init() for a policy. Cc: Andrew Lunn <[email protected]> Cc: David S. Miller <[email protected]> Cc: Dmitry Eremin-Solenikov <[email protected]> Cc: Eric Miao <[email protected]> Cc: Hans-Christian Egtvedt <[email protected]> Cc: Jesper Nilsson <[email protected]> Cc: John Crispin <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Linus Walleij <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Mikael Starvik <[email protected]> Cc: Paul Mundt <[email protected]> Cc: Russell King <[email protected]> Cc: Santosh Shilimkar <[email protected]> Cc: Sekhar Nori <[email protected]> Cc: Shawn Guo <[email protected]> Cc: [email protected] Cc: Stephen Warren <[email protected]> Cc: Steven Miao <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Viresh Kumar <[email protected]> --- drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4d37306..a7a1d3e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1038,6 +1038,14 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif, goto err_set_policy_cpu; } + if (cpufreq_driver->get) { + policy->cur = cpufreq_driver->get(policy->cpu); + if (!policy->cur) { + pr_err("%s: ->get() failed\n", __func__); + goto err_get_freq; + } + } + /* related cpus should atleast have policy->cpus */ cpumask_or(policy->related_cpus, policy->related_cpus, policy->cpus); @@ -1097,6 +1105,9 @@ err_out_unregister: } write_unlock_irqrestore(&cpufreq_driver_lock, flags); +err_get_freq: + if (cpufreq_driver->exit) + cpufreq_driver->exit(policy); err_set_policy_cpu: per_cpu(cpufreq_policy_cpu, cpu) = -1; cpufreq_policy_free(policy); -- 1.7.12.rc2.18.g61b472e -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

