Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: processor: idle: Reset power_setup_done flag on initialization failure

The 'power_setup_done' flag is a key indicator used across the ACPI
processor driver to determine if cpuidle are properly configured and
available for a given CPU.

Currently, this flag is set during the early stages of initialization.
However, if the subsequent registration of the cpuidle driver in
acpi_processor_register_idle_driver() or the per-CPU device registration
in acpi_processor_power_init() fails, this flag remains set. This may
lead to some issues where other functions in ACPI idle driver use these
flags.

Fix this by explicitly resetting this flag to 0 in these error paths.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/20260403085343.866440-1-lihuisong@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Huisong Li and committed by
Rafael J. Wysocki
02c68ed1 00154eed

+11
+11
drivers/acpi/processor_idle.c
··· 1379 1379 1380 1380 ret = cpuidle_register_driver(&acpi_idle_driver); 1381 1381 if (ret) { 1382 + pr->flags.power_setup_done = 0; 1382 1383 pr_debug("register %s failed.\n", acpi_idle_driver.name); 1383 1384 return; 1384 1385 } ··· 1388 1387 1389 1388 void acpi_processor_unregister_idle_driver(void) 1390 1389 { 1390 + struct acpi_processor *pr; 1391 + int cpu; 1392 + 1391 1393 cpuidle_unregister_driver(&acpi_idle_driver); 1394 + for_each_possible_cpu(cpu) { 1395 + pr = per_cpu(processors, cpu); 1396 + if (!pr) 1397 + continue; 1398 + pr->flags.power_setup_done = 0; 1399 + } 1392 1400 } 1393 1401 1394 1402 void acpi_processor_power_init(struct acpi_processor *pr) ··· 1434 1424 */ 1435 1425 if (cpuidle_register_device(dev)) { 1436 1426 per_cpu(acpi_cpuidle_device, pr->id) = NULL; 1427 + pr->flags.power_setup_done = 0; 1437 1428 kfree(dev); 1438 1429 } 1439 1430 }