Currently, processor_driver just use the global acpi_idle_driver variable to check if the cpuidle driver is acpi_idle_driver. Actually, there is no need to expose this global variable defined in processor_idle.c to outside. So move the related logical to acpi_processor_power_init() and do not expose it. Signed-off-by: Huisong Li <lihuisong@xxxxxxxxxx> --- drivers/acpi/processor_driver.c | 3 +-- drivers/acpi/processor_idle.c | 5 +++++ include/acpi/processor.h | 1 - 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index bc9f58a02c1d..5d824435b26b 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -166,8 +166,7 @@ static int __acpi_processor_start(struct acpi_device *device) if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS)) dev_dbg(&device->dev, "CPPC data invalid or not present\n"); - if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver) - acpi_processor_power_init(pr); + acpi_processor_power_init(pr); acpi_pss_perf_init(pr); diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 5dacf41d7cc0..967fb13f38fa 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1404,6 +1404,11 @@ int acpi_processor_power_init(struct acpi_processor *pr) { int retval; struct cpuidle_device *dev; + struct cpuidle_driver *drv; + + drv = cpuidle_get_driver(); + if (drv && drv != &acpi_idle_driver) + return 0; if (disabled_by_idle_boot_param()) return 0; diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 6ee4a69412de..bd96dde5eef5 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h @@ -417,7 +417,6 @@ static inline void acpi_processor_throttling_init(void) {} #endif /* CONFIG_ACPI_CPU_FREQ_PSS */ /* in processor_idle.c */ -extern struct cpuidle_driver acpi_idle_driver; #ifdef CONFIG_ACPI_PROCESSOR_IDLE int acpi_processor_power_init(struct acpi_processor *pr); int acpi_processor_power_exit(struct acpi_processor *pr); -- 2.33.0