linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
@ 2014-04-15 22:27 Stratos Karafotis
  2014-04-16  1:11 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stratos Karafotis @ 2014-04-15 22:27 UTC (permalink / raw)
  To: Simon Horman, Magnus Damm; +Cc: Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  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:13 ` Simon Horman
  2014-04-21 23:02 ` [PATCH v4 " Stratos Karafotis
  2 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2014-04-16  1:11 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Magnus Damm, Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML

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>

Thanks, I have queued this up.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  2014-04-16  1:11 ` Simon Horman
@ 2014-04-16  1:24   ` Simon Horman
  2014-04-16  4:12     ` Viresh Kumar
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2014-04-16  1:24 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Magnus Damm, Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML

On Wed, Apr 16, 2014 at 10:11:20AM +0900, Simon Horman wrote:
> 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>
> 
> Thanks, I have queued this up.

I have dropped this patch.

Please let me know if there is a stable branch which
includes cpufreq_frequency_table which I can use as a base to apply
this patch.

Alternatively, I would be happy to Ack this patch and let someone
else pick up this patch, but I'm entirely unclear on who that would be.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  2014-04-16  1:24   ` Simon Horman
@ 2014-04-16  4:12     ` Viresh Kumar
  2014-04-16  4:13       ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: Viresh Kumar @ 2014-04-16  4:12 UTC (permalink / raw)
  To: Simon Horman
  Cc: Stratos Karafotis, Magnus Damm, Rafael J. Wysocki, SH-Linux, LKML

On 16 April 2014 06:54, Simon Horman <horms@verge.net.au> wrote:
> I have dropped this patch.
>
> Please let me know if there is a stable branch which
> includes cpufreq_frequency_table which I can use as a base to apply
> this patch.
>
> Alternatively, I would be happy to Ack this patch and let someone
> else pick up this patch, but I'm entirely unclear on who that would be.

Rafael will take this patch, please Ack it :)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  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  4:13 ` Simon Horman
  2014-04-16  7:04   ` Stratos Karafotis
  2014-04-21 23:02 ` [PATCH v4 " Stratos Karafotis
  2 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2014-04-16  4:13 UTC (permalink / raw)
  To: Stratos Karafotis
  Cc: Magnus Damm, Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML

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
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  2014-04-16  4:12     ` Viresh Kumar
@ 2014-04-16  4:13       ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2014-04-16  4:13 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Stratos Karafotis, Magnus Damm, Rafael J. Wysocki, SH-Linux, LKML

On Wed, Apr 16, 2014 at 09:30:24AM +0530, Viresh Kumar wrote:
> On 16 April 2014 06:54, Simon Horman <horms@verge.net.au> wrote:
> > I have dropped this patch.
> >
> > Please let me know if there is a stable branch which
> > includes cpufreq_frequency_table which I can use as a base to apply
> > this patch.
> >
> > Alternatively, I would be happy to Ack this patch and let someone
> > else pick up this patch, but I'm entirely unclear on who that would be.
> 
> Rafael will take this patch, please Ack it :)

Thanks, done.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  2014-04-16  4:13 ` Simon Horman
@ 2014-04-16  7:04   ` Stratos Karafotis
  0 siblings, 0 replies; 8+ messages in thread
From: Stratos Karafotis @ 2014-04-16  7:04 UTC (permalink / raw)
  To: Simon Horman; +Cc: Magnus Damm, Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML

On 16/04/2014 07:13 πμ, Simon Horman wrote:
> 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>
> 

Thanks!

Stratos


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v4 8/8] sh: clk: Use cpufreq_for_each_valid_entry macro for iteration
  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  4:13 ` Simon Horman
@ 2014-04-21 23:02 ` Stratos Karafotis
  2 siblings, 0 replies; 8+ messages in thread
From: Stratos Karafotis @ 2014-04-21 23:02 UTC (permalink / raw)
  To: Simon Horman, Magnus Damm
  Cc: Rafael J. Wysocki, Viresh Kumar, linux-sh, LKML,
	linux-pm@vger.kernel.org

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-04-21 23:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-04-16  7:04   ` Stratos Karafotis
2014-04-21 23:02 ` [PATCH v4 " Stratos Karafotis

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