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@huawei.com>
---
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
On Thu, Sep 11, 2025 at 1:24 PM Huisong Li <lihuisong@huawei.com> wrote:
>
> 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.
And it can also be made static, can't it?
Please do that too.
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> 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);
> --
在 2025/9/18 4:01, Rafael J. Wysocki 写道:
> On Thu, Sep 11, 2025 at 1:24 PM Huisong Li <lihuisong@huawei.com> wrote:
>> 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.
> And it can also be made static, can't it?
ok, will do it in next version. Thanks.
>
> Please do that too.
>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
>> ---
>> 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);
>> --
On Thu, Sep 18, 2025 at 2:23 PM lihuisong (C) <lihuisong@huawei.com> wrote: > > > 在 2025/9/18 4:01, Rafael J. Wysocki 写道: > > On Thu, Sep 11, 2025 at 1:24 PM Huisong Li <lihuisong@huawei.com> wrote: > >> 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. > > And it can also be made static, can't it? > ok, will do it in next version. Thanks. You may as well rebase it on top of this one: https://lore.kernel.org/linux-acpi/5044465.31r3eYUQgx@rafael.j.wysocki/
在 2025/9/19 5:22, Rafael J. Wysocki 写道: > On Thu, Sep 18, 2025 at 2:23 PM lihuisong (C) <lihuisong@huawei.com> wrote: >> >> 在 2025/9/18 4:01, Rafael J. Wysocki 写道: >>> On Thu, Sep 11, 2025 at 1:24 PM Huisong Li <lihuisong@huawei.com> wrote: >>>> 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. >>> And it can also be made static, can't it? >> ok, will do it in next version. Thanks. > You may as well rebase it on top of this one: > > https://lore.kernel.org/linux-acpi/5044465.31r3eYUQgx@rafael.j.wysocki/ Ok, will will fix it based your patch. Thank you for the reminder. >
© 2016 - 2026 Red Hat, Inc.