From: Dirk Brandewie <dirk.brandewie@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: rjw@sisk.pl, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org,
dirk.brandewie@gmail.com
Subject: Re: [PATCH RESEND 11/11] cpufreq: add new routine cpufreq_verify_within_cpu_limits()
Date: Wed, 02 Oct 2013 10:40:33 -0700 [thread overview]
Message-ID: <524C5A91.6000005@gmail.com> (raw)
In-Reply-To: <269a6a5bf55462c3e0aa0b96e6aba2f811ac9871.1380703248.git.viresh.kumar@linaro.org>
On 10/02/2013 01:43 AM, Viresh Kumar wrote:
> Most of the users of cpufreq_verify_within_limits() calls it for limiting with
> min/max from policy->cpuinfo. We can make that code simple by introducing
> another routine which will do this for them automatically.
>
> This patch adds another routine cpufreq_verify_within_cpu_limits() and updates
> others to use it.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/cpufreq-nforce2.c | 4 +---
> drivers/cpufreq/davinci-cpufreq.c | 4 +---
> drivers/cpufreq/freq_table.c | 6 ++----
> drivers/cpufreq/integrator-cpufreq.c | 9 ++-------
> drivers/cpufreq/intel_pstate.c | 4 +---
> drivers/cpufreq/longrun.c | 4 +---
> drivers/cpufreq/pcc-cpufreq.c | 3 +--
> drivers/cpufreq/sh-cpufreq.c | 7 ++-----
> drivers/cpufreq/unicore2-cpufreq.c | 4 +---
> include/linux/cpufreq.h | 7 +++++++
> 10 files changed, 19 insertions(+), 33 deletions(-)
>
For intel_pstate portion
Acked-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
> diff --git a/drivers/cpufreq/cpufreq-nforce2.c b/drivers/cpufreq/cpufreq-nforce2.c
> index b83d45f6..56c964c 100644
> --- a/drivers/cpufreq/cpufreq-nforce2.c
> +++ b/drivers/cpufreq/cpufreq-nforce2.c
> @@ -303,9 +303,7 @@ static int nforce2_verify(struct cpufreq_policy *policy)
> if (policy->min < (fsb_pol_max * fid * 100))
> policy->max = (fsb_pol_max + 1) * fid * 100;
>
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
> return 0;
> }
>
> diff --git a/drivers/cpufreq/davinci-cpufreq.c b/drivers/cpufreq/davinci-cpufreq.c
> index f67196e..ba03e6f 100644
> --- a/drivers/cpufreq/davinci-cpufreq.c
> +++ b/drivers/cpufreq/davinci-cpufreq.c
> @@ -50,9 +50,7 @@ static int davinci_verify_speed(struct cpufreq_policy *policy)
> if (policy->cpu)
> return -EINVAL;
>
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> -
> + cpufreq_verify_within_cpu_limits(policy);
> policy->min = clk_round_rate(armclk, policy->min * 1000) / 1000;
> policy->max = clk_round_rate(armclk, policy->max * 1000) / 1000;
> cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
> index 10f3cfb..b9336ed 100644
> --- a/drivers/cpufreq/freq_table.c
> +++ b/drivers/cpufreq/freq_table.c
> @@ -60,8 +60,7 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
> pr_debug("request for verification of policy (%u - %u kHz) for cpu %u\n",
> policy->min, policy->max, policy->cpu);
>
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
>
> for (; freq = table[i].frequency, freq != CPUFREQ_TABLE_END; i++) {
> if (freq == CPUFREQ_ENTRY_INVALID)
> @@ -77,8 +76,7 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
>
> if (!found) {
> policy->max = next_larger;
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
> }
>
> pr_debug("verification lead to (%u - %u kHz) for cpu %u\n",
> diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c
> index f7c99df..8152a9b 100644
> --- a/drivers/cpufreq/integrator-cpufreq.c
> +++ b/drivers/cpufreq/integrator-cpufreq.c
> @@ -59,9 +59,7 @@ static int integrator_verify_policy(struct cpufreq_policy *policy)
> {
> struct icst_vco vco;
>
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
>
> vco = icst_hz_to_vco(&cclk_params, policy->max * 1000);
> policy->max = icst_hz(&cclk_params, vco) / 1000;
> @@ -69,10 +67,7 @@ static int integrator_verify_policy(struct cpufreq_policy *policy)
> vco = icst_hz_to_vco(&cclk_params, policy->min * 1000);
> policy->min = icst_hz(&cclk_params, vco) / 1000;
>
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> -
> + cpufreq_verify_within_cpu_limits(policy);
> return 0;
> }
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 32b3479..22b8d54 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -614,9 +614,7 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
>
> static int intel_pstate_verify_policy(struct cpufreq_policy *policy)
> {
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
>
> if ((policy->policy != CPUFREQ_POLICY_POWERSAVE) &&
> (policy->policy != CPUFREQ_POLICY_PERFORMANCE))
> diff --git a/drivers/cpufreq/longrun.c b/drivers/cpufreq/longrun.c
> index 5aa0316..074971b 100644
> --- a/drivers/cpufreq/longrun.c
> +++ b/drivers/cpufreq/longrun.c
> @@ -129,9 +129,7 @@ static int longrun_verify_policy(struct cpufreq_policy *policy)
> return -EINVAL;
>
> policy->cpu = 0;
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
>
> if ((policy->policy != CPUFREQ_POLICY_POWERSAVE) &&
> (policy->policy != CPUFREQ_POLICY_PERFORMANCE))
> diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c
> index 70438de..160cc1e 100644
> --- a/drivers/cpufreq/pcc-cpufreq.c
> +++ b/drivers/cpufreq/pcc-cpufreq.c
> @@ -111,8 +111,7 @@ static struct pcc_cpu __percpu *pcc_cpu_info;
>
> static int pcc_cpufreq_verify(struct cpufreq_policy *policy)
> {
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
> return 0;
> }
>
> diff --git a/drivers/cpufreq/sh-cpufreq.c b/drivers/cpufreq/sh-cpufreq.c
> index 1362e88..f1fb944 100644
> --- a/drivers/cpufreq/sh-cpufreq.c
> +++ b/drivers/cpufreq/sh-cpufreq.c
> @@ -87,15 +87,12 @@ static int sh_cpufreq_verify(struct cpufreq_policy *policy)
> if (freq_table)
> return cpufreq_frequency_table_verify(policy, freq_table);
>
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> + cpufreq_verify_within_cpu_limits(policy);
>
> policy->min = (clk_round_rate(cpuclk, 1) + 500) / 1000;
> policy->max = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000;
>
> - cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> - policy->cpuinfo.max_freq);
> -
> + cpufreq_verify_within_cpu_limits(policy);
> return 0;
> }
>
> diff --git a/drivers/cpufreq/unicore2-cpufreq.c b/drivers/cpufreq/unicore2-cpufreq.c
> index b225f04..14e6d31 100644
> --- a/drivers/cpufreq/unicore2-cpufreq.c
> +++ b/drivers/cpufreq/unicore2-cpufreq.c
> @@ -29,9 +29,7 @@ static int ucv2_verify_speed(struct cpufreq_policy *policy)
> if (policy->cpu)
> return -EINVAL;
>
> - cpufreq_verify_within_limits(policy,
> - policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
> -
> + cpufreq_verify_within_cpu_limits(policy);
> return 0;
> }
>
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 6c9c365..ddc6332 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -256,6 +256,13 @@ static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy,
> return;
> }
>
> +static inline void
> +cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy)
> +{
> + cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
> + policy->cpuinfo.max_freq);
> +}
> +
> /*********************************************************************
> * CPUFREQ NOTIFIER INTERFACE *
> *********************************************************************/
>
prev parent reply other threads:[~2013-10-02 17:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 8:43 [PATCH RESEND 00/11] CPUFreq: Cleanups/fixes for v3.13 Viresh Kumar
2013-10-02 8:43 ` [PATCH RESEND 01/11] cpufreq: make return type of lock_policy_rwsem_{read|write}() as void Viresh Kumar
2013-10-03 7:09 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 02/11] cpufreq: create per policy rwsem instead of per cpu cpu_policy_rwsem Viresh Kumar
2013-10-03 7:23 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 03/11] cpufreq: remove invalid comment from __cpufreq_remove_dev() Viresh Kumar
2013-10-03 7:25 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 04/11] cpufreq: Remove extra blank line Viresh Kumar
2013-10-03 7:26 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 05/11] cpufreq: don't break string in print statements Viresh Kumar
2013-10-02 8:43 ` [PATCH RESEND 06/11] cpufreq: remove __cpufreq_remove_dev() Viresh Kumar
2013-10-02 8:43 ` [PATCH RESEND 07/11] cpufreq: Optimize cpufreq_frequency_table_verify() Viresh Kumar
2013-10-02 8:43 ` [PATCH RESEND 08/11] cpufreq: rename __cpufreq_set_policy() as cpufreq_set_policy() Viresh Kumar
2013-10-02 8:43 ` [PATCH RESEND 09/11] cpufreq: rewrite cpufreq_driver->flags using shift operator Viresh Kumar
2013-10-03 7:32 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 10/11] cpufreq: use cpufreq_driver->flags to mark CPUFREQ_HAVE_GOVERNOR_PER_POLICY Viresh Kumar
2013-10-03 7:39 ` Srivatsa S. Bhat
2013-10-02 8:43 ` [PATCH RESEND 11/11] cpufreq: add new routine cpufreq_verify_within_cpu_limits() Viresh Kumar
2013-10-02 17:40 ` Dirk Brandewie [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=524C5A91.6000005@gmail.com \
--to=dirk.brandewie@gmail.com \
--cc=cpufreq@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--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).