[PATCH i-g-t 16/16] tests/kms_writeback: use for_each_output()

Jani Nikula
2026-04-14T07:17:01Z

Use for_each_output() instead of manually iterating display->outputs[i].

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
tests/kms_writeback.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index 4a5f369ba6d8..7c30e8ee3591 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -143,7 +143,7 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output,

static igt_output_t *kms_writeback_get_output(igt_display_t *display)
{
- int i;
+ igt_output_t *output;
igt_crtc_t *crtc;

drmModeModeInfo override_mode = {
@@ -163,9 +163,7 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)
.name = {"640x480-60"},
};

- for (i = 0; i < display->n_outputs; i++) {
- igt_output_t *output = &display->outputs[i];
-
+ for_each_output(display, output) {
if (output->config.connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
continue;

@@ -464,9 +462,9 @@ static void commit_and_dump_fb(igt_display_t *display, igt_output_t *output, igt

static igt_output_t *list_writeback_modes(igt_display_t *display)
{
- for (int i = 0; i < display->n_outputs; i++) {
- igt_output_t *output = &display->outputs[i];
+ igt_output_t *output;

+ for_each_output(display, output) {
if (output->config.connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK) {
drmModeModeInfo *mode;
int j = 0;
--
2.47.3