Skip to content

Commit 22c52fa

Browse files
committed
ACPI: processor: thermal: Update CPU cooling devices on cpufreq policy changes
When a cpufreq policy appears or goes away, the CPU cooling devices for the CPUs covered by that policy need to be updated so that the new processor_get_max_state() value is stored as max_state and the statistics in sysfs are rearranged for each of them. Do that accordingly in acpi_thermal_cpufreq_init() and acpi_thermal_cpufreq_exit(). Fixes: a365105("thermal: sysfs: Reuse cdev->max_state") Reported-by: Wang, Quanxian <[email protected]> Link: https://lore.kernel.org/linux-pm/[email protected] Signed-off-by: Rafael J. Wysocki <[email protected]> Tested-by: Zhang Rui <[email protected]> Reviewed-by: Zhang Rui <[email protected]>
1 parent 790930f commit 22c52fa

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/acpi/processor_thermal.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,13 @@ void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
140140
ret = freq_qos_add_request(&policy->constraints,
141141
&pr->thermal_req,
142142
FREQ_QOS_MAX, INT_MAX);
143-
if (ret < 0)
143+
if (ret < 0) {
144144
pr_err("Failed to add freq constraint for CPU%d (%d)\n",
145145
cpu, ret);
146+
continue;
147+
}
148+
149+
thermal_cooling_device_update(pr->cdev);
146150
}
147151
}
148152

@@ -153,8 +157,12 @@ void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
153157
for_each_cpu(cpu, policy->related_cpus) {
154158
struct acpi_processor *pr = per_cpu(processors, cpu);
155159

156-
if (pr)
157-
freq_qos_remove_request(&pr->thermal_req);
160+
if (!pr)
161+
continue;
162+
163+
freq_qos_remove_request(&pr->thermal_req);
164+
165+
thermal_cooling_device_update(pr->cdev);
158166
}
159167
}
160168
#else /* ! CONFIG_CPU_FREQ */

0 commit comments

Comments
 (0)