Linux-PM Archive on lore.kernel.org
 help / color / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Eduardo Valentin <edubezval@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:CPU FREQUENCY SCALING FRAMEWORK" 
	<linux-pm@vger.kernel.org>
Subject: Re: [PATCH 1/6] cpufreq: Use existing stub functions instead of IS_ENABLED macro
Date: Mon, 24 Jun 2019 11:37:17 +0200
Message-ID: <225a3a6e-94d8-f801-6388-5ec90ca19e11@linaro.org> (raw)
In-Reply-To: <2097869.93pjHihJNk@kreacher>

On 24/06/2019 11:30, Rafael J. Wysocki wrote:
> On Monday, June 24, 2019 11:22:19 AM CEST Daniel Lezcano wrote:
>> On 22/06/2019 11:12, Rafael J. Wysocki wrote:
>>> On Fri, Jun 21, 2019 at 3:23 PM Daniel Lezcano
>>> <daniel.lezcano@linaro.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:
> 
> Well,
> 
>> #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
> 
> This may as well be defined as
> 
> static inline int cpufreq_is_cooling_dev(struct cpufreq_driver *drv)
> {
> 	return IS_ENABLED(CPU_THERMAL) && drv->flags & CPUFREQ_IS_COOLING_DEV;
> }
> 
> which is fewer lines of code.

Ah yes, even better.

> And I would call it something like cpufreq_thermal_control_enabled().

Ok, thanks!




-- 
 <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


  reply index

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-21 13:22 Daniel Lezcano
2019-06-21 13:22 ` [PATCH 2/6] thermal/drivers/cpu_cooling: Unregister with the policy Daniel Lezcano
2019-06-24  6:03   ` Viresh Kumar
2019-06-24  7:30     ` Daniel Lezcano
2019-06-24  7:37       ` Viresh Kumar
2019-06-24  7:45         ` Daniel Lezcano
2019-06-24  9:39           ` Viresh Kumar
2019-06-21 13:22 ` [PATCH 3/6] cpufreq/drivers/arm_big_little: Remove cooling device usage Daniel Lezcano
2019-06-24  6:04   ` Viresh Kumar
2019-06-21 13:23 ` [PATCH 4/6] cpufreq: " Daniel Lezcano
2019-06-24  6:05   ` Viresh Kumar
2019-06-21 13:23 ` [PATCH 5/6] thermal/drivers/imx: " Daniel Lezcano
2019-06-24  6:06   ` Viresh Kumar
2019-06-21 13:23 ` [PATCH 6/6] thermal/drivers/ti: " Daniel Lezcano
2019-06-24  6:06   ` Viresh Kumar
2019-06-22  9:12 ` [PATCH 1/6] cpufreq: Use existing stub functions instead of IS_ENABLED macro Rafael J. Wysocki
2019-06-24  9:22   ` Daniel Lezcano
2019-06-24  9:30     ` Rafael J. Wysocki
2019-06-24  9:37       ` Daniel Lezcano [this message]
2019-06-24  8:53 ` Daniel Lezcano
2019-06-24  9:00   ` Rafael J. Wysocki
2019-06-24  9:07     ` Daniel Lezcano
2019-06-24  9:08   ` Viresh Kumar

Reply instructions:

You may reply publically 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=225a3a6e-94d8-f801-6388-5ec90ca19e11@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --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

Linux-PM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pm/0 linux-pm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pm linux-pm/ https://lore.kernel.org/linux-pm \
		linux-pm@vger.kernel.org linux-pm@archiver.kernel.org
	public-inbox-index linux-pm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox