Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t v2 1/2] tests/intel/xe_configfs: Use openat to simplify check
Date: Mon,  2 Jun 2025 09:24:44 -0700	[thread overview]
Message-ID: <20250602-engines-allowed-v2-1-52bffe717766@intel.com> (raw)
In-Reply-To: <20250602-engines-allowed-v2-0-52bffe717766@intel.com>

No need to create the path again. Just make sure there's such attribute
relative to the fd passed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 tests/intel/xe_configfs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index e5701b7d1..074cd04d9 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -43,16 +43,13 @@ static void set_survivability_mode(int configfs_device_fd, bool value)
  */
 static void test_survivability_mode(int configfs_device_fd)
 {
-	char path[PATH_MAX];
 	int fd;
 
 	/* Enable survivability mode */
 	set_survivability_mode(configfs_device_fd, true);
 
 	/* check presence of survivability mode sysfs */
-	snprintf(path, PATH_MAX, "/sys/bus/pci/devices/%s/survivability_mode", bus_addr);
-
-	fd = open(path, O_RDONLY);
+	fd = openat(configfs_device_fd, "survivability_mode", O_RDONLY);
 	igt_assert_f(fd >= 0, "Survivability mode not set\n");
 	close(fd);
 }

-- 
2.49.0


  reply	other threads:[~2025-06-02 16:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 16:24 [PATCH i-g-t v2 0/2] xe: Add test for engines_allowed in configfs Lucas De Marchi
2025-06-02 16:24 ` Lucas De Marchi [this message]
2025-06-03  6:15   ` [PATCH i-g-t v2 1/2] tests/intel/xe_configfs: Use openat to simplify check Riana Tauro
2025-06-03  6:37     ` Lucas De Marchi
2025-06-02 16:24 ` [PATCH i-g-t v2 2/2] tests/intel/xe_configfs: Test engines_allowed Lucas De Marchi
2025-06-06 11:16   ` Riana Tauro
2025-06-09 22:42   ` Umesh Nerlige Ramappa
2025-06-12 21:27     ` Lucas De Marchi
2025-06-02 21:19 ` ✓ i915.CI.BAT: success for xe: Add test for engines_allowed in configfs Patchwork
2025-06-02 21:21 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-03  1:01 ` ✓ i915.CI.Full: " Patchwork
2025-06-03 20:17 ` ✗ 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=20250602-engines-allowed-v2-1-52bffe717766@intel.com \
    --to=lucas.demarchi@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