From: wangyouwan <wangyouwan@126.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: viresh.kumar@linaro.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH] cpufreq: create cooling device based on ACPI
Date: Wed, 10 May 2023 15:51:12 +0800 (CST) [thread overview]
Message-ID: <2225e42.53da.18804a48b33.Coremail.wangyouwan@126.com> (raw)
In-Reply-To: <CAJZ5v0jT0tiwQtTpg-YeptVYq_t80o0nW3O7d9OBDmAxdv8=Dw@mail.gmail.com>
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@kernel.org> wrote:
>On Fri, Apr 28, 2023 at 9:19 AM <wangyouwan@126.com> wrote:
>>
>> From: youwan Wang <wangyouwan@126.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@126.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");
>>
>> --
next prev parent reply other threads:[~2023-05-10 8:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 7:03 [PATCH] cpufreq: create cooling device based on ACPI wangyouwan
2023-04-28 9:56 ` Dhruva Gole
2023-05-10 8:48 ` wangyouwan
2023-04-28 11:37 ` Rafael J. Wysocki
2023-05-10 7:51 ` wangyouwan [this message]
2023-05-08 7:12 ` 回复: " Xinglong Yang
[not found] ` <205f534.5815.18804b3dd08.Coremail.wangyouwan@126.com>
[not found] ` <PUZPR06MB5498536FCB73BD6D5BD928ECF0779@PUZPR06MB5498.apcprd06.prod.outlook.com>
2023-05-10 8:45 ` Re:回复: " wangyouwan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2225e42.53da.18804a48b33.Coremail.wangyouwan@126.com \
--to=wangyouwan@126.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox