Skip to content

Commit c0e0421

Browse files
committed
ACPI: processor: Reorder acpi_processor_driver_init()
The cpufreq policy notifier in the ACPI processor driver may as well be registered before the driver itself, which causes acpi_processor_cpufreq_init to be true (unless the notifier registration fails, which is unlikely at that point) when the ACPI CPU thermal cooling devices are registered, so the processor_get_max_state() result does not change while acpi_processor_driver_init() is running. Change the ordering in acpi_processor_driver_init() accordingly to prevent the max_state value from remaining 0 permanently for all ACPI CPU cooling devices due to setting acpi_processor_cpufreq_init too late. [Note that processor_get_max_state() may still return different values at different times after this change, depending on the cpufreq driver registration time, but that issue needs to be addressed separately.] 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 e8d018d commit c0e0421

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/acpi/processor_driver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ static int __init acpi_processor_driver_init(void)
263263
if (acpi_disabled)
264264
return 0;
265265

266+
if (!cpufreq_register_notifier(&acpi_processor_notifier_block,
267+
CPUFREQ_POLICY_NOTIFIER)) {
268+
acpi_processor_cpufreq_init = true;
269+
acpi_processor_ignore_ppc_init();
270+
}
271+
266272
result = driver_register(&acpi_processor_driver);
267273
if (result < 0)
268274
return result;
@@ -276,12 +282,6 @@ static int __init acpi_processor_driver_init(void)
276282
cpuhp_setup_state_nocalls(CPUHP_ACPI_CPUDRV_DEAD, "acpi/cpu-drv:dead",
277283
NULL, acpi_soft_cpu_dead);
278284

279-
if (!cpufreq_register_notifier(&acpi_processor_notifier_block,
280-
CPUFREQ_POLICY_NOTIFIER)) {
281-
acpi_processor_cpufreq_init = true;
282-
acpi_processor_ignore_ppc_init();
283-
}
284-
285285
acpi_processor_throttling_init();
286286
return 0;
287287
err:

0 commit comments

Comments
 (0)