[igt-dev] [PATCH i-g-t 07/10] lib/psr: Drop support to old kernels without new PSR debugfs interface

José Roberto de Souza jose.souza at intel.com
Sat Jan 12 01:46:04 UTC 2019


The nexts patches will add PSR2 tests and for that we need the new
PSR debugfs interface that was released in kernel 4.20 so it will not
break for any updated system and we can drop support to the old
debugsfs and the support to kernels without even a debugfs interface.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 lib/igt_psr.c | 35 +++++++----------------------------
 1 file changed, 7 insertions(+), 28 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index c6638c2c..5cc0fbc2 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -73,27 +73,7 @@ static int has_psr_debugfs(int debugfs_fd)
 	 * -ENODEV is returned when PSR is unavailable.
 	 */
 	ret = psr_write(debugfs_fd, "0xf");
-	if (ret == -EINVAL)
-		return 0;
-	else if (ret < 0)
-		return ret;
-
-	/* legacy debugfs api, we enabled irqs by writing, disable them. */
-	psr_write(debugfs_fd, "0");
-	return -EINVAL;
-}
-
-static bool psr_modparam_set(int val)
-{
-	static int oldval = -1;
-
-	igt_set_module_param_int("enable_psr", val);
-
-	if (val == oldval)
-		return false;
-
-	oldval = val;
-	return true;
+	return ret == -EINVAL ? 0 : ret;
 }
 
 static int psr_restore_debugfs_fd = -1;
@@ -109,16 +89,15 @@ static bool psr_set(int debugfs_fd, bool enable)
 
 	ret = has_psr_debugfs(debugfs_fd);
 	if (ret == -ENODEV) {
-		igt_skip_on_f(enable, "PSR not available\n");
+		igt_skip("PSR not available\n");
+		return false;
+	} else if (ret) {
+		igt_skip("PSR debugfs interface not available\n");
 		return false;
 	}
 
-	if (ret == -EINVAL) {
-		ret = psr_modparam_set(enable);
-	} else {
-		ret = psr_write(debugfs_fd, enable ? "0x3" : "0x1");
-		igt_assert(ret > 0);
-	}
+	ret = psr_write(debugfs_fd, enable ? "0x3" : "0x1");
+	igt_assert(ret > 0);
 
 	/* Restore original value on exit */
 	if (psr_restore_debugfs_fd == -1) {
-- 
2.20.1



More information about the igt-dev mailing list