[PATCH i-g-t v5 2/3] lib/xe/xe_query: Fix compilation -Wshadow warning

Nirmoy Das nirmoy.das at intel.com
Wed Jan 17 17:28:45 UTC 2024


Fix -Wshadow warning when xe_for_each_engine() and
xe_for_each_mem_region are used together.

v2: Use igt_unique(Kamil)

Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
Reviewed-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
---
 lib/xe/xe_query.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/xe/xe_query.h b/lib/xe/xe_query.h
index 1e3a7bdb9..2460384c9 100644
--- a/lib/xe/xe_query.h
+++ b/lib/xe/xe_query.h
@@ -58,8 +58,8 @@ struct xe_device {
 };
 
 #define xe_for_each_engine(__fd, __hwe) \
-	for (int __i = 0; __i < xe_number_engines(__fd) && \
-	     (__hwe = &xe_engine(__fd, __i)->instance); ++__i)
+	for (int igt_unique(__i) = 0; igt_unique(__i) < xe_number_engines(__fd) && \
+	     (__hwe = &xe_engine(__fd, igt_unique(__i))->instance); ++igt_unique(__i))
 #define xe_for_each_engine_class(__class) \
 	for (__class = 0; __class < DRM_XE_ENGINE_CLASS_COMPUTE + 1; \
 	     ++__class)
@@ -67,8 +67,8 @@ struct xe_device {
 	for (__gt = 0; __gt < xe_number_gt(__fd); ++__gt)
 
 #define xe_for_each_mem_region(__fd, __memreg, __r) \
-	for (uint64_t __i = 0; __i < igt_fls(__memreg); __i++) \
-		for_if(__r = (__memreg & (1ull << __i)))
+	for (uint64_t igt_unique(__i) = 0; igt_unique(__i) < igt_fls(__memreg); igt_unique(__i)++) \
+		for_if(__r = (__memreg & (1ull << igt_unique(__i))))
 
 #define XE_IS_CLASS_SYSMEM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM)
 #define XE_IS_CLASS_VRAM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_VRAM)
-- 
2.42.0



More information about the igt-dev mailing list