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

Kolanupaka Naveena kolanupaka.naveena at intel.com
Fri May 16 15:55:33 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 9421b8503..92225300c 100644
--- a/tests/intel/xe_mmap.c
+++ b/tests/intel/xe_mmap.c
@@ -438,15 +438,14 @@ 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));
 			igt_fork(child, 1)
 				test_pci_membarrier_parallel(xe, child, i);
 			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