public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH i-g-t 1/3] lib/kms: Avoid local iterator variable in for_each_output()
Date: Mon, 13 Apr 2026 23:00:19 +0300	[thread overview]
Message-ID: <20260413200021.29485-2-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20260413200021.29485-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Rewrite for_each_output() into a form where we don't need the
extra iterator variable. This will allow nested use of the
iterator.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 lib/igt_kms.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 9a3fa980d89d..57824b82f5f9 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -689,9 +689,10 @@ static inline bool igt_crtc_connector_valid(igt_crtc_t *crtc, igt_output_t *outp
  *
  * This for loop iterates over all outputs.
  */
-#define for_each_output(display, output)		\
-	for (int i__ = 0;  assert(igt_can_fail()), i__ < (display)->n_outputs; i__++)	\
-		for_each_if (((output) = (&(display)->outputs[i__])))
+#define for_each_output(display, output) \
+	for ((output) = &(display)->outputs[0]; \
+	     (output) < &(display)->outputs[(display)->n_outputs]; \
+	     (output)++)
 
 /**
  * for_each_connected_output:
-- 
2.52.0


  reply	other threads:[~2026-04-13 20:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 20:00 [PATCH i-g-t 0/3] tests/kms: Nuke local iterator macros Ville Syrjala
2026-04-13 20:00 ` Ville Syrjala [this message]
2026-04-13 20:00 ` [PATCH i-g-t 2/3] tests/kms: Nuke local copies of for_each_valid_output_on_crtc() Ville Syrjala
2026-04-13 20:00 ` [PATCH i-g-t 3/3] tests/kms: Use for_each_crtc_with_valid_output() Ville Syrjala
2026-04-14  1:24 ` ✗ i915.CI.BAT: failure for tests/kms: Nuke local iterator macros Patchwork
2026-04-14  1:37 ` ✓ Xe.CI.BAT: success " Patchwork
2026-04-14  4:38 ` ✓ Xe.CI.FULL: " Patchwork
2026-04-14  7:00 ` [PATCH i-g-t 0/3] " Jani Nikula
2026-04-15 16:41 ` ✓ Xe.CI.BAT: success for tests/kms: Nuke local iterator macros (rev2) Patchwork
2026-04-15 17:02 ` ✓ i915.CI.BAT: " Patchwork
2026-04-15 18:23 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-15 23:07 ` ✗ i915.CI.Full: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260413200021.29485-2-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox