Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3db386d9 authored by Viresh Kumar's avatar Viresh Kumar Committed by Junjie Wu
Browse files

cpufreq: call cpufreq_driver->get() after calling ->init()



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.

Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Git-commit: da60ce9f2faca87013fd3cab1c3bed5183608c3d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent 1a491aee
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1057,6 +1057,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);

@@ -1121,6 +1129,9 @@ err_out_unregister:
		per_cpu(cpufreq_cpu_data, j) = NULL;
	write_unlock_irqrestore(&cpufreq_driver_lock, flags);

err_get_freq:
	if (cpufreq_driver->exit)
		cpufreq_driver->exit(policy);
err_set_policy_cpu:
	cpufreq_policy_free(policy);
nomem_out: