From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
Karthik B S <karthik.b.s@intel.com>
Subject: [PATCH i-g-t v2 1/5] tests/prime_udl: Fix opening
Date: Wed, 22 Apr 2026 17:44:19 +0200 [thread overview]
Message-ID: <20260422154423.141908-2-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20260422154423.141908-1-kamil.konieczny@linux.intel.com>
Cards numbering can be non-sequential so create a way to open
them in such case.
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Reviewed-by: Karthik B S <karthik.b.s@intel.com>
---
tests/prime_udl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/prime_udl.c b/tests/prime_udl.c
index 25950a09d..c3e92be1e 100644
--- a/tests/prime_udl.c
+++ b/tests/prime_udl.c
@@ -27,13 +27,13 @@ static int find_and_open_devices(void)
FILE *fl;
char vendor_id[8];
int venid;
- for (i = 0; i < 9; i++) {
+ for (i = 0; i < 9 && intel_fd == -1 && udl_fd == -1; i++) {
sprintf(path, "/sys/class/drm/card%d/device/vendor", i);
if (stat(path, &buf)) {
/* look for usb dev */
sprintf(path, "/sys/class/drm/card%d/device/idVendor", i);
if (stat(path, &buf))
- break;
+ continue;
}
fl = fopen(path, "r");
@@ -45,11 +45,11 @@ static int find_and_open_devices(void)
venid = strtoul(vendor_id, NULL, 16);
sprintf(path, "/dev/dri/card%d", i);
- if (venid == 0x8086) {
+ if (venid == 0x8086 && intel_fd == -1) {
intel_fd = open(path, O_RDWR);
if (!intel_fd)
return -1;
- } else if (venid == 0x17e9) {
+ } else if (venid == 0x17e9 && udl_fd == -1) {
udl_fd = open(path, O_RDWR);
if (!udl_fd)
return -1;
--
2.54.0
next prev parent reply other threads:[~2026-04-22 15:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-22 15:44 [PATCH i-g-t v2 0/5] Various fixes for prime_udl test Kamil Konieczny
2026-04-22 15:44 ` Kamil Konieczny [this message]
2026-04-22 15:44 ` [PATCH i-g-t v2 2/5] tests/prime_udl: Create subtests Kamil Konieczny
2026-04-23 10:25 ` Karthik B S
2026-04-22 15:44 ` [PATCH i-g-t v2 3/5] tests/prime_udl: Fix error handling Kamil Konieczny
2026-04-22 15:44 ` [PATCH i-g-t v2 4/5] tests/prime_udl: Fix i915 device opening Kamil Konieczny
2026-04-22 15:44 ` [PATCH i-g-t v2 5/5] tests/prime_udl: Rename into i915_prime_udl Kamil Konieczny
2026-04-23 10:29 ` Karthik B S
2026-04-24 12:47 ` Kamil Konieczny
2026-04-27 3:43 ` Karthik B S
2026-04-22 23:00 ` ✗ i915.CI.BAT: failure for Various fixes for prime_udl test (rev3) Patchwork
2026-04-23 0:03 ` ✓ Xe.CI.BAT: success " Patchwork
2026-04-23 8:15 ` ✗ Xe.CI.FULL: failure " 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=20260422154423.141908-2-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@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