[Intel-gfx] [PATCH 05/12] dmar: Use for_each_If

Daniel Vetter daniel.vetter at ffwll.ch
Mon Jul 9 08:36:43 UTC 2018


Avoids the inverted conditions compared to the open coded version.

Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
Cc: Joerg Roedel <jroedel at 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



More information about the Intel-gfx mailing list