[PATCH i-g-t v2 1/2] tests/intel/xe_configfs: Use openat to simplify check
Lucas De Marchi
lucas.demarchi at intel.com
Tue Jun 3 06:37:46 UTC 2025
On Tue, Jun 03, 2025 at 11:45:20AM +0530, Riana Tauro wrote:
>Hi Lucas
>
>On 6/2/2025 9:54 PM, Lucas De Marchi wrote:
>>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);
>
>This is the file that indicates that the device entered survivability
>mode. This is under /sys/bus/pci/devices/<bdf>/ not the one in
>configfs
oh.. missed that. We can drop this patch
thanks
Lucas De Marchi
]
>
>Thanks
>Riana
>
>>-
>>- 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);
>> }
>>
>
More information about the igt-dev
mailing list