igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Moahmmed Bilal <mohammed.bilal@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: jeevan.b@intel.com, kunal1.joshi@intel.com,
	Mohammed Bilal <mohammed.bilal@intel.com>
Subject: [PATCH i-g-t 1/2] RFC: chamelium/kms_chamelium_hpd: add helper function to select connector port
Date: Thu,  4 Dec 2025 20:47:49 +0530	[thread overview]
Message-ID: <20251204151750.633993-2-mohammed.bilal@intel.com> (raw)
In-Reply-To: <20251204151750.633993-1-mohammed.bilal@intel.com>

From: Mohammed Bilal <mohammed.bilal@intel.com>

Introduce a new helper function get_port() which returns the
chamelium_port matching the requested connector type.
The helper iterates through the available ports and
returns the first match, or NULL if no matching connector is found.

Signed-off-by: Mohammed Bilal <mohammed.bilal@intel.com>
---
 tests/chamelium/kms_chamelium_hpd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/chamelium/kms_chamelium_hpd.c b/tests/chamelium/kms_chamelium_hpd.c
index 161f494e9..3c8af63bd 100644
--- a/tests/chamelium/kms_chamelium_hpd.c
+++ b/tests/chamelium/kms_chamelium_hpd.c
@@ -158,6 +158,21 @@ enum test_modeset_mode {
 	TEST_MODESET_OFF,
 };
 
+__maybe_unused
+static struct chamelium_port *get_port(struct chamelium_port **ports,
+				       int port_count, int connector_type)
+{
+	int i;
+
+	for (i = 0; i < port_count; i++) {
+		if (chamelium_port_get_type(ports[i]) ==
+		    connector_type)
+			return ports[i];
+	}
+
+	return NULL;
+}
+
 static void try_suspend_resume_hpd(chamelium_data_t *data,
 				   struct chamelium_port *port,
 				   enum igt_suspend_state state,
-- 
2.48.1


  reply	other threads:[~2025-12-05  8:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 15:17 [PATCH i-g-t 0/2] RFC: Fix chamelium port allocation during igt_fixture Moahmmed Bilal
2025-12-04 15:17 ` Moahmmed Bilal [this message]
2025-12-04 15:17 ` [PATCH i-g-t 2/2] RFC: chamelium/kms_chamelium_hpd: use helper function for connector lookup in DP/HDMI/VGA tests Moahmmed Bilal
  -- strict thread matches above, loose matches on Subject: below --
2025-12-05  7:32 [PATCH i-g-t 0/2] RFC: Fix chamelium port allocation during igt_fixture Moahmmed Bilal
2025-12-05  7:32 ` [PATCH i-g-t 1/2] RFC: chamelium/kms_chamelium_hpd: add helper function to select connector port Moahmmed Bilal
2025-12-05  7:46 [PATCH i-g-t 0/2] RFC: Fix chamelium port allocation during igt_fixture Moahmmed Bilal
2025-12-05  7:46 ` [PATCH i-g-t 1/2] RFC: chamelium/kms_chamelium_hpd: add helper function to select connector port Moahmmed Bilal
2025-12-05 10:15   ` Sebastian Brzezinka

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=20251204151750.633993-2-mohammed.bilal@intel.com \
    --to=mohammed.bilal@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jeevan.b@intel.com \
    --cc=kunal1.joshi@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).