lkml.org 
[lkml]   [2018]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/12] dmar: Use for_each_If
Date
Avoids the inverted conditions compared to the open coded version.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Joerg Roedel <jroedel@suse.de>
---
include/linux/dmar.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index e2433bc50210..99397504e75e 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -85,15 +85,15 @@ extern struct list_head dmar_drhd_units;

#define for_each_active_drhd_unit(drhd) \
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
- if (drhd->ignored) {} else
+ for_each_if (!drhd->ignored)

#define for_each_active_iommu(i, drhd) \
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
- if (i=drhd->iommu, drhd->ignored) {} else
+ for_each_if ((i=drhd->iommu, !drhd->ignored))

#define for_each_iommu(i, drhd) \
list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \
- if (i=drhd->iommu, 0) {} else
+ for_each_if ((i=drhd->iommu, true))

static inline bool dmar_rcu_check(void)
{
@@ -108,7 +108,8 @@ static inline bool dmar_rcu_check(void)
NULL, (p) < (c)); (p)++)

#define for_each_active_dev_scope(a, c, p, d) \
- for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else
+ for_each_dev_scope((a), (c), (p), (d)) \
+ for_each_if (d)

extern int dmar_table_init(void);
extern int dmar_dev_scope_init(void);
--
2.18.0
\
 
 \ /
  Last update: 2018-07-09 10:44    [W:0.123 / U:6.824 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site