[PATCH i-g-t 1/2] tests/intel/xe_configfs: Use openat to simplify check

Lucas De Marchi lucas.demarchi at intel.com
Wed May 28 22:04:34 UTC 2025


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 at 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



More information about the igt-dev mailing list