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

Commit 5c23f020 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "thermal: cpu_cooling: Aggregate cooling device vote for all related CPUs"

parents d12acda0 c7b1c57f
Loading
Loading
Loading
Loading
+23 −24
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
				    unsigned long event, void *data)
{
	struct cpufreq_policy *policy = data;
	unsigned long clipped_freq, floor_freq;
	unsigned long clipped_freq = ULONG_MAX, floor_freq = 0;
	struct cpufreq_cooling_device *cpufreq_dev;

	if (event != CPUFREQ_ADJUST)
@@ -338,9 +338,14 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,

	mutex_lock(&cooling_list_lock);
	list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {
		if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus))
		if (!cpumask_intersects(&cpufreq_dev->allowed_cpus,
					policy->related_cpus))
			continue;

		if (cpufreq_dev->clipped_freq < clipped_freq)
			clipped_freq = cpufreq_dev->clipped_freq;
		if (cpufreq_dev->floor_freq > floor_freq)
			floor_freq = cpufreq_dev->floor_freq;
	}
	/*
	 * policy->max is the maximum allowed frequency defined by user
	 * and clipped_freq is the maximum that thermal constraints
@@ -355,14 +360,8 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
	 * Similarly, if policy minimum set by the user is less than
	 * the floor_frequency, then adjust the policy->min.
	 */
		clipped_freq = cpufreq_dev->clipped_freq;
		floor_freq = cpufreq_dev->floor_freq;

	if (policy->max > clipped_freq || policy->min < floor_freq)
			cpufreq_verify_within_limits(policy, floor_freq,
						     clipped_freq);
		break;
	}
		cpufreq_verify_within_limits(policy, floor_freq, clipped_freq);
	mutex_unlock(&cooling_list_lock);

	return NOTIFY_OK;