Re: [Intel-gfx] [PATCH 04/12] cpufreq: use for_each_if

2018-07-09 Thread Eric Engestrom
On Monday, 2018-07-09 10:36:42 +0200, Daniel Vetter wrote:
> Avoids the inverted condition compared to the open coded version.
> 
> Signed-off-by: Daniel Vetter 
> Cc: "Rafael J. Wysocki" 
> Cc: Viresh Kumar 
> Cc: linux...@vger.kernel.org
> ---
>  include/linux/cpufreq.h | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index 882a9b9e34bc..f2028c229b96 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -649,9 +649,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct 
> device *dev,
>  
>  #define cpufreq_for_each_valid_entry(pos, table) \
>   for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)   \
> - if (pos->frequency == CPUFREQ_ENTRY_INVALID)\
> - continue;   \
> - else
> + for_each_if (pos->frequency != CPUFREQ_ENTRY_INVALID)
>  
>  /*
>   * cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq
> @@ -663,9 +661,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct 
> device *dev,
>  
>  #define cpufreq_for_each_valid_entry_idx(pos, table, idx)\
>   cpufreq_for_each_entry_idx(pos, table, idx) \
> - if (pos->frequency == CPUFREQ_ENTRY_INVALID)\
> - continue;   \
> - else
> + for_each_if (pos->frequency == CPUFREQ_ENTRY_INVALID)

Should be `!=` there ^

>  
>  
>  int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
> -- 
> 2.18.0
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 04/12] cpufreq: use for_each_if

2018-07-09 Thread Daniel Vetter
Avoids the inverted condition compared to the open coded version.

Signed-off-by: Daniel Vetter 
Cc: "Rafael J. Wysocki" 
Cc: Viresh Kumar 
Cc: linux...@vger.kernel.org
---
 include/linux/cpufreq.h | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 882a9b9e34bc..f2028c229b96 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -649,9 +649,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct 
device *dev,
 
 #define cpufreq_for_each_valid_entry(pos, table)   \
for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++)   \
-   if (pos->frequency == CPUFREQ_ENTRY_INVALID)\
-   continue;   \
-   else
+   for_each_if (pos->frequency != CPUFREQ_ENTRY_INVALID)
 
 /*
  * cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq
@@ -663,9 +661,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct 
device *dev,
 
 #define cpufreq_for_each_valid_entry_idx(pos, table, idx)  \
cpufreq_for_each_entry_idx(pos, table, idx) \
-   if (pos->frequency == CPUFREQ_ENTRY_INVALID)\
-   continue;   \
-   else
+   for_each_if (pos->frequency == CPUFREQ_ENTRY_INVALID)
 
 
 int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
-- 
2.18.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx