Skip to contentSkip to conversation

intel_reg: Use static iterator

PATCH In review Petri Latvala 3 participants 3 messages Jan 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_reg: Use static iterator

Convert open-coded for loops to __for_each_static_engine. That takes care of the last direct user of intel_execution_engines2.

More work is needed to make intel_reg support dynamically queried engines but this restores the old functionality.

---
 tools/intel_reg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/intel_reg.c +2 -2
index 847fdbed..5f1beba4 100644
@@ -252,7 +252,7 @@ static const struct intel_execution_engine2 *find_engine(const char *name)
 	if (name[0] == '-')
 		name++;
 
-	for (e = intel_execution_engines2; e->name; e++) {
+	__for_each_static_engine(e) {
 		if (!strcasecmp(e->name, name))
 			return e;
 	}
@@ -783,7 +783,7 @@ static int intel_reg_help(struct config *config, int argc, char *argv[])
 	printf("\n\n");
 
 	printf("ENGINE is one of:\n");
-	for (e = intel_execution_engines2; e->name; e++)
+	__for_each_static_engine(e)
 		printf("%s -%s ", e->name, e->name);
 	printf("\n\n");
 
Signature · 6 lines
2.20.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Petri Latvala

Convert open-coded for loops to __for_each_static_engine. That takes care of the last direct user of intel_execution_engines2.

More work is needed to make intel_reg support dynamically queried engines but this restores the old functionality.

---
  tools/intel_reg.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/intel_reg.c +1 -1
index 847fdbed..5f1beba4 100644
@@ -252,7 +252,7 @@ static const struct intel_execution_engine2 *find_engine(const char *name)
  	if (name[0] == '-')
  		name++;
 
-	for (e = intel_execution_engines2; e->name; e++) {
+	__for_each_static_engine(e) {
  		if (!strcasecmp(e->name, name))
  			return e;
  	}

tools/intel_reg.c static int intel_reg_help(struct config *config, int argc, char *argv[]) · line 789

Quoted 8 lines
tools/intel_reg.c +1 -1
@@ -783,7 +783,7 @@ static int intel_reg_help(struct config *config, int argc, char *argv[])
  	printf("\n\n");
 
  	printf("ENGINE is one of:\n");
-	for (e = intel_execution_engines2; e->name; e++)
+	__for_each_static_engine(e)
  		printf("%s -%s ", e->name, e->name);
  	printf("\n\n");
 

My bad for not grepping outside lib and tests with the previous patch. Thanks for jumping in!

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for intel_reg: Use static iterator

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: intel_reg: Use static iterator
URL : https://patchwork.freedesktop.org/series/72470/
State : failure

== Summary ==

Series 72470 revision 1 was fully merged or fully failed: no git log

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev