[PATCH v2 5/5] lib/igt_gt: Stop passing fd == -1 in igt_open_forcewake_handle()

Lucas De Marchi lucas.demarchi at intel.com
Mon Sep 23 22:11:46 UTC 2024


If something like -1 is needed, then
igt_open_forcewake_handle_for_pcidev() should be used.

Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 lib/igt_gt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index c9fd9164f..ba4163c97 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -493,6 +493,7 @@ void igt_stop_hang_helper(void)
 
 /**
  * igt_open_forcewake_handle:
+ * @fd: drm fd - i915 or xe
  *
  * This functions opens the debugfs forcewake file and so prevents the GT from
  * suspending. The reference is automatically dropped when the is closed.
@@ -509,8 +510,10 @@ int igt_open_forcewake_handle(int fd)
 
 	if (is_xe_device(fd))
 		fn = "forcewake_all";
-	else
+	else if (is_i915_device(fd))
 		fn = "i915_forcewake_user";
+	else
+		return -1;
 
 	return igt_debugfs_open(fd, fn, O_RDONLY);
 }
-- 
2.46.1



More information about the igt-dev mailing list