linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-pm@vger.kernel.org,
	Vincent Guittot <vincent.guittot@linaro.org>,
	sudeep.holla@arm.com, Dietmar.Eggemann@arm.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cpufreq: Return 0 from ->fast_switch() on errors
Date: Fri, 11 Aug 2017 01:13:10 +0200	[thread overview]
Message-ID: <8693637.6NBGkAB8Q9@aspire.rjw.lan> (raw)
In-Reply-To: <a219f5b42d06a78bd254ca1b23047d45702f12d2.1502254023.git.viresh.kumar@linaro.org>

On Wednesday, August 9, 2017 6:51:46 AM CEST Viresh Kumar wrote:
> CPUFREQ_ENTRY_INVALID is a special symbol which is used to specify that
> an entry in the cpufreq table is invalid. But using it outside of the
> scope of the cpufreq table looks a bit incorrect.
> 
> We can represent an invalid frequency by writing it as 0 instead if we
> need. Note that it is already done that way for the return value of the
> ->get() callback.
> 
> Lets do the same for ->fast_switch() and not use CPUFREQ_ENTRY_INVALID
> outside of the scope of cpufreq table.
> 
> Also update the comment over cpufreq_driver_fast_switch() to clearly
> mention what this returns.
> 
> None of the drivers return CPUFREQ_ENTRY_INVALID as of now from
> ->fast_switch() callback and so we don't need to update any of those.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/cpufreq/cpufreq.c        | 7 ++++---
>  kernel/sched/cpufreq_schedutil.c | 2 +-
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index b2cc98551fc3..9588e15da26b 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1832,9 +1832,10 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier);
>   * twice in parallel for the same policy and that it will never be called in
>   * parallel with either ->target() or ->target_index() for the same policy.
>   *
> - * If CPUFREQ_ENTRY_INVALID is returned by the driver's ->fast_switch()
> - * callback to indicate an error condition, the hardware configuration must be
> - * preserved.
> + * Returns the actual frequency set for the CPU.
> + *
> + * If 0 is returned by the driver's ->fast_switch() callback to indicate an
> + * error condition, the hardware configuration must be preserved.
>   */
>  unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
>  					unsigned int target_freq)
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 5465bf221e8f..2e74c49776be 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -123,7 +123,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time,
>  
>  	if (policy->fast_switch_enabled) {
>  		next_freq = cpufreq_driver_fast_switch(policy, next_freq);
> -		if (next_freq == CPUFREQ_ENTRY_INVALID)
> +		if (!next_freq)
>  			return;
>  
>  		policy->cur = next_freq;
> 

Applied, thanks!

      reply	other threads:[~2017-08-10 23:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09  4:51 [PATCH] cpufreq: Return 0 from ->fast_switch() on errors Viresh Kumar
2017-08-10 23:13 ` Rafael J. Wysocki [this message]

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=8693637.6NBGkAB8Q9@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=Dietmar.Eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).