[PATCH i-g-t 2/2] tests/intel/xe_mmap: Fix open/close calls

Kolanupaka Naveena kolanupaka.naveena at intel.com
Wed May 21 10:41:22 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.

Also drop the srand() call as this is already taken care by igt-core.

Reviewed-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 aa76df507..117a3ab85 100644
--- a/tests/intel/xe_mmap.c
+++ b/tests/intel/xe_mmap.c
@@ -444,8 +444,7 @@ igt_main
 			unsigned int i;
 			uint32_t *ptr;
 
-			xe = drm_open_driver(DRIVER_XE);
-			srand(time(0));
+			xe = drm_reopen_driver(fd);
 			i = rand() % (PAGE_SIZE / sizeof(*ptr));
 			prepare_pci_membarrier_test(fd, &fw_handle);
 			igt_fork(child, 1)
@@ -453,7 +452,7 @@ igt_main
 			test_pci_membarrier_parallel(fd, -1, i);
 			igt_waitchildren();
 
-			close(xe);
+			drm_close_driver(xe);
 		}
 
 		igt_subtest("pci-membarrier-bad-pagesize") {
-- 
2.34.1



More information about the igt-dev mailing list