public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Yue Hu <zbestahu@gmail.com>
Cc: rjw@rjwysocki.net, rafael.j.wysocki@intel.com,
	linux-pm@vger.kernel.org, huyue2@yulong.com
Subject: Re: [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get()
Date: Mon, 22 Apr 2019 13:49:02 +0530	[thread overview]
Message-ID: <20190422081902.xeiu66gpspcjbrol@vireshk-i7> (raw)
In-Reply-To: <20190419062759.8524-1-zbestahu@gmail.com>

On 19-04-19, 14:27, Yue Hu wrote:
> From: Yue Hu <huyue2@yulong.com>
> 
> Currenly, __cpufreq_get() called by show_cpuinfo_cur_freq() will check
> ->get callback. That is needless since cpuinfo_cur_freq attribute will
> not be created if ->get is not set. So let's drop it in __cpufreq_get().
> Also keep this check in cpufreq_get().
> 
> Signed-off-by: Yue Hu <huyue2@yulong.com>
> ---
>  drivers/cpufreq/cpufreq.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 047662b..c6187f1 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -1548,7 +1548,7 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
>  {
>  	unsigned int ret_freq = 0;
>  
> -	if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
> +	if (unlikely(policy_is_inactive(policy)))
>  		return ret_freq;
>  
>  	ret_freq = cpufreq_driver->get(policy->cpu);
> @@ -1586,7 +1586,8 @@ unsigned int cpufreq_get(unsigned int cpu)
>  
>  	if (policy) {
>  		down_read(&policy->rwsem);
> -		ret_freq = __cpufreq_get(policy);
> +		if (cpufreq_driver->get)
> +			ret_freq = __cpufreq_get(policy);
>  		up_read(&policy->rwsem);
>  
>  		cpufreq_cpu_put(policy);

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

-- 
viresh

  parent reply	other threads:[~2019-04-22  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  6:27 [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Yue Hu
2019-04-19  6:27 ` [PATCH] cpufreq: Expose real_cpus out to userspace Yue Hu
2019-04-22  8:23   ` Viresh Kumar
2019-04-22  8:19 ` Viresh Kumar [this message]
2019-05-01 10:39   ` [PATCH] cpufreq: Move ->get callback check outside of __cpufreq_get() Rafael J. Wysocki

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=20190422081902.xeiu66gpspcjbrol@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=huyue2@yulong.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=zbestahu@gmail.com \
    /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