[Intel-gfx] [PATCH] lib/igt.cocci: Add stanza for for_each_pipe
Daniel Vetter
daniel.vetter at ffwll.ch
Fri Jul 11 17:44:04 CEST 2014
Damien dodged this ...
Also run the script while at it.
v2: Don't just capture identifiers for pipe, but also expressions.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
lib/igt.cocci | 10 ++++++++++
tests/kms_cursor_crc.c | 2 +-
tests/kms_fbc_crc.c | 2 +-
tests/kms_fence_pin_leak.c | 2 +-
4 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lib/igt.cocci b/lib/igt.cocci
index 3246924f2c38..d399496b256f 100644
--- a/lib/igt.cocci
+++ b/lib/igt.cocci
@@ -74,3 +74,13 @@ expression list[n] Ep;
@@
-abort();
+igt_fail(1);
+
+@@
+iterator name for_each_pipe;
+igt_display_t *display;
+expression pipe;
+@@
+- for (pipe = 0; pipe < igt_display_get_n_pipes(display); pipe++) {
++ for_each_pipe (display, pipe) {
+...
+}
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 82807b7bf435..bbbf053d3207 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -303,7 +303,7 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int
for_each_connected_output(display, output) {
data->output = output;
- for (p = 0; p < igt_display_get_n_pipes(display); p++) {
+ for_each_pipe(display, p) {
data->pipe = p;
if (!prepare_crtc(data, output, cursor_w, cursor_h))
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index a99bf367c528..b0108b1c4aa3 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -454,7 +454,7 @@ static void run_test(data_t *data, enum test_mode mode)
reset_display(data);
for_each_connected_output(display, data->output) {
- for (data->pipe = 0; data->pipe < igt_display_get_n_pipes(display); data->pipe++) {
+ for_each_pipe(display, data->pipe) {
if (!prepare_crtc(data))
continue;
diff --git a/tests/kms_fence_pin_leak.c b/tests/kms_fence_pin_leak.c
index ef2e6872eb8e..6a05d977217c 100644
--- a/tests/kms_fence_pin_leak.c
+++ b/tests/kms_fence_pin_leak.c
@@ -196,7 +196,7 @@ static void run_test(data_t *data)
enum pipe p;
for_each_connected_output(display, output) {
- for (p = 0; p < igt_display_get_n_pipes(display); p++) {
+ for_each_pipe(display, p) {
if (run_single_test(data, p, output))
return; /* one time ought to be enough */
}
--
2.0.0
More information about the Intel-gfx
mailing list