linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Stratos Karafotis <stratosk@semaphore.gr>
Cc: Magnus Damm <magnus.damm@gmail.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-sh@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
Date: Wed, 16 Apr 2014 04:13:46 +0000	[thread overview]
Message-ID: <20140416041345.GC27534@verge.net.au> (raw)
In-Reply-To: <534DB238.5030201@semaphore.gr>

On Wed, Apr 16, 2014 at 01:27:04AM +0300, Stratos Karafotis wrote:
> The cpufreq core now supports the cpufreq_for_each_valid_entry macro
> helper for iteration over the cpufreq_frequency_table, so use it.
> 
> It should have no functional changes.
> 
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>

Rafael, please feel free to take this one.

Acked-by: Simon Horman <horms+renesas@verge.net.au>

> ---
>  drivers/sh/clk/core.c | 20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
> index 7472785..be56b22 100644
> --- a/drivers/sh/clk/core.c
> +++ b/drivers/sh/clk/core.c
> @@ -196,17 +196,11 @@ int clk_rate_table_find(struct clk *clk,
>  			struct cpufreq_frequency_table *freq_table,
>  			unsigned long rate)
>  {
> -	int i;
> -
> -	for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
> -		unsigned long freq = freq_table[i].frequency;
> +	struct cpufreq_frequency_table *pos;
>  
> -		if (freq = CPUFREQ_ENTRY_INVALID)
> -			continue;
> -
> -		if (freq = rate)
> -			return i;
> -	}
> +	cpufreq_for_each_valid_entry(pos, freq_table)
> +		if (pos->frequency = rate)
> +			return pos - freq_table;
>  
>  	return -ENOENT;
>  }
> @@ -575,11 +569,7 @@ long clk_round_parent(struct clk *clk, unsigned long target,
>  		return abs(target - *best_freq);
>  	}
>  
> -	for (freq = parent->freq_table; freq->frequency != CPUFREQ_TABLE_END;
> -	     freq++) {
> -		if (freq->frequency = CPUFREQ_ENTRY_INVALID)
> -			continue;
> -
> +	cpufreq_for_each_valid_entry(freq, parent->freq_table) {
>  		if (unlikely(freq->frequency / target <= div_min - 1)) {
>  			unsigned long freq_max;
>  
> -- 
> 1.9.0
> 

  parent reply	other threads:[~2014-04-16  4:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 22:27 [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration Stratos Karafotis
2014-04-16  1:11 ` Simon Horman
2014-04-16  1:24   ` Simon Horman
2014-04-16  4:12     ` Viresh Kumar
2014-04-16  4:13       ` Simon Horman
2014-04-16  4:13 ` Simon Horman [this message]
2014-04-16  7:04   ` Stratos Karafotis
2014-04-21 23:02 ` [PATCH v4 " Stratos Karafotis

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=20140416041345.GC27534@verge.net.au \
    --to=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stratosk@semaphore.gr \
    --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).