[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b817a599-6564-b3d0-9c91-59c3fd5b5eb1@linaro.org>
Date: Mon, 24 Jun 2019 11:22:19 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Viresh Kumar <viresh.kumar@...aro.org>,
Eduardo Valentin <edubezval@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
"open list:CPU FREQUENCY SCALING FRAMEWORK"
<linux-pm@...r.kernel.org>
Subject: Re: [PATCH 1/6] cpufreq: Use existing stub functions instead of
IS_ENABLED macro
On 22/06/2019 11:12, Rafael J. Wysocki wrote:
> On Fri, Jun 21, 2019 at 3:23 PM Daniel Lezcano
> <daniel.lezcano@...aro.org> wrote:
>>
>> The functions stub already exist for the condition the IS_ENABLED
>> is trying to avoid.
>>
>> Remove the IS_ENABLED macros as they are pointless.
>
> AFAICS, the IS_ENABLED checks are an optimization to avoid generating
> pointless code (including a branch) in case CONFIG_CPU_THERMAL is not
> set.
>
> Why do you think that it is not useful?
I agree but I'm not a big fan of IS_ENABLED macros in the code when it
is possible to avoid them.
What about adding a stub for that like:
#ifdef CPU_THERMAL
static inline int cpufreq_is_cooling_dev(struct cpufreq_driver *drv)
{
return drv->flags & CPUFREQ_IS_COOLING_DEV;
}
#else
static inline int cpufreq_is_cooling_dev(struct cpufreq_driver *drv)
{
return 0;
}
#endif
?
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
>> ---
>> drivers/cpufreq/cpufreq.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 85ff958e01f1..7c72f7d3509c 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -1378,8 +1378,7 @@ static int cpufreq_online(unsigned int cpu)
>> if (cpufreq_driver->ready)
>> cpufreq_driver->ready(policy);
>>
>> - if (IS_ENABLED(CONFIG_CPU_THERMAL) &&
>> - cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV)
>> + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV)
>> policy->cdev = of_cpufreq_cooling_register(policy);
>>
>> pr_debug("initialization complete\n");
>> @@ -1469,8 +1468,7 @@ static int cpufreq_offline(unsigned int cpu)
>> goto unlock;
>> }
>>
>> - if (IS_ENABLED(CONFIG_CPU_THERMAL) &&
>> - cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) {
>> + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) {
>> cpufreq_cooling_unregister(policy->cdev);
>> policy->cdev = NULL;
>> }
>> --
>> 2.17.1
>>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Powered by blists - more mailing lists