[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2225e42.53da.18804a48b33.Coremail.wangyouwan@126.com>
Date: Wed, 10 May 2023 15:51:12 +0800 (CST)
From: wangyouwan <wangyouwan@....com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: viresh.kumar@...aro.org, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re:Re: [PATCH] cpufreq: create cooling device based on ACPI
Okay, thank you for the reminder!
If I make this change, I'm not sure if it will work. If it does, I'll submit a new patch.
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1494,8 +1494,13 @@ static int cpufreq_online(unsigned int cpu)
if (cpufreq_driver->ready)
cpufreq_driver->ready(policy);
- if (cpufreq_thermal_control_enabled(cpufreq_driver))
- policy->cdev = of_cpufreq_cooling_register(policy);
+ if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
+ struct device_node *np = of_get_cpu_node(policy->cpu, NULL);
+ if (np)
+ policy->cdev = of_cpufreq_cooling_register(policy);
+ else
+ policy->cdev = cpufreq_cooling_register(policy);
+ }
At 2023-04-28 19:37:26, "Rafael J. Wysocki" <rafael@...nel.org> wrote:
>On Fri, Apr 28, 2023 at 9:19 AM <wangyouwan@....com> wrote:
>>
>> From: youwan Wang <wangyouwan@....com>
>>
>> When using the "scpi_cpufreq" driver, an error
>> occurs:cpufreq_cooling: OF node not available for cpu*.
>> The current computer motherboard is using ACPI firmware.
>> Go to see that the error is caused by calling the
>> "of_cpufreq_cooling_register" interface.
>> comment:create cpufreq cooling device based on DT.
>>
>> Signed-off-by: youwan Wang <wangyouwan@....com>
>> ---
>> drivers/cpufreq/cpufreq.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 6b52ebe5a890..3418c68959d5 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1528,8 +1528,13 @@ static int cpufreq_online(unsigned int cpu)
>> if (cpufreq_driver->ready)
>> cpufreq_driver->ready(policy);
>>
>> - if (cpufreq_thermal_control_enabled(cpufreq_driver))
>> + if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
>> +#ifdef CONFIG_ACPI
>> + policy->cdev = cpufreq_cooling_register(policy);
>> +#else
>> policy->cdev = of_cpufreq_cooling_register(policy);
>> +#endif
>
>Please avoid adding #ifdefs like this in random places.
>
>Moreover, what if the kernel supports ACPI and the platform is DT-based?
>
>> + }
>>
>> pr_debug("initialization complete\n");
>>
>> --
Powered by blists - more mailing lists