[PATCH i-g-t 2/2] tests/intel/xe_mmap: Use appropriate drm APIs

Kolanupaka Naveena kolanupaka.naveena at intel.com
Fri May 16 13:58:19 UTC 2025


Instead of using the standard drm_open and close APIs for driver
open and close operations, use the appropriate drm_reopen and
drm_close APIs to ensure the driver is opened and closed correctly.

Suggested-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
Signed-off-by: Kolanupaka Naveena <kolanupaka.naveena at intel.com>
---
 tests/intel/xe_mmap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_mmap.c b/tests/intel/xe_mmap.c
index 061b3de0a..abd144ac0 100644
--- a/tests/intel/xe_mmap.c
+++ b/tests/intel/xe_mmap.c
@@ -436,8 +436,7 @@ igt_main
 		uint32_t *ptr;
 
 		igt_require(is_pci_membarrier_supported(fd));
-		xe = drm_open_driver(DRIVER_XE);
-		srand(time(0));
+		xe = drm_reopen_driver(fd);
 		i = rand() % (PAGE_SIZE / sizeof(*ptr));
 		fw_handle = igt_debugfs_open(fd, "forcewake_all", O_RDONLY);
 		igt_assert_lte(0, fw_handle);
@@ -447,7 +446,7 @@ igt_main
 		igt_waitchildren();
 
 		close(fw_handle);
-		close(xe);
+		drm_close_driver(xe);
 	}
 
 	igt_subtest("pci-membarrier-bad-pagesize") {
-- 
2.34.1



More information about the igt-dev mailing list