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

Commit 820c6ca2 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki
Browse files

cpufreq: Don't call __cpufreq_governor() for drivers without target()



Some cpufreq drivers implement their own governor and so don't need
us to call generic governors interface via __cpufreq_governor(). Few
recent commits haven't obeyed this law well and we saw some
regressions.

This patch is an attempt to fix the above issue.

Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Reported-and-tested-by: default avatarSedat Dilek <sedat.dilek@gmail.com>
Tested-by: default avatarDirk Brandewie <dirk.brandewie@gmail.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 70eb0855
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -858,12 +858,17 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling,
				  struct device *dev)
{
	struct cpufreq_policy *policy;
	int ret = 0;
	int ret = 0, has_target = 0;
	unsigned long flags;

	policy = cpufreq_cpu_get(sibling);
	WARN_ON(!policy);

	rcu_read_lock();
	has_target = !!rcu_dereference(cpufreq_driver)->target;
	rcu_read_unlock();

	if (has_target)
		__cpufreq_governor(policy, CPUFREQ_GOV_STOP);

	lock_policy_rwsem_write(sibling);
@@ -877,8 +882,10 @@ static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling,

	unlock_policy_rwsem_write(sibling);

	if (has_target) {
		__cpufreq_governor(policy, CPUFREQ_GOV_START);
		__cpufreq_governor(policy, CPUFREQ_GOV_LIMITS);
	}

	ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
	if (ret) {
@@ -1146,6 +1153,7 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif

	/* If cpu is last user of policy, free policy */
	if (cpus == 1) {
		if (has_target)
			__cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);

		lock_policy_rwsem_read(cpu);