summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2024-05-03 15:47:44 -0700
committerLucas De Marchi <lucas.demarchi@intel.com>2024-05-06 13:03:24 -0700
commit022b83443d594bd2ca909735872ab663e4ad5672 (patch)
tree1ccb54c7eae013a59889882a607ab76f1f4f2096
parent3f70c934874d55cfadd8bf36027293bb7fa200e7 (diff)
lib/igt_aux: Name function according to sysfs file
Let's follow the sysfs filename that is being written/read so it's not misinterpreted as something else: at first I thought it was dealing with /sys/power/state, which it's not. Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://lore.kernel.org/r/20240503224745.14890-2-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
-rw-r--r--lib/igt_aux.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d6aeb876b..18461fe8e 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -732,7 +732,7 @@ static const char *mem_sleep_name[] = {
[MEM_SLEEP_DEEP] = "deep"
};
-static enum igt_suspend_test get_suspend_test(int power_dir)
+static enum igt_suspend_test get_pm_test(int power_dir)
{
char *test_line;
char *test_name;
@@ -765,10 +765,15 @@ static enum igt_suspend_test get_suspend_test(int power_dir)
return test;
}
-static void set_suspend_test(int power_dir, enum igt_suspend_test test)
+static void set_pm_test(int power_dir, enum igt_suspend_test test)
{
igt_assert(test < SUSPEND_TEST_NUM);
+ /*
+ * When pm_test is available, it needs to be cleared or set to specific
+ * test before /sys/power/state is written (which is also done by
+ * rtcwake)
+ */
if (faccessat(power_dir, "pm_test", W_OK, 0)) {
igt_require(test == SUSPEND_TEST_NONE);
return;
@@ -1009,7 +1014,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
!igt_get_total_swap_mb(),
"Suspend to disk requires swap space.\n");
- orig_test = get_suspend_test(power_dir);
+ orig_test = get_pm_test(power_dir);
igt_aux_enable_pm_suspend_dbg(power_dir);
if (state == SUSPEND_STATE_S3) {
@@ -1021,7 +1026,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
"S3 not possible in this system.\n");
}
- set_suspend_test(power_dir, test);
+ set_pm_test(power_dir, test);
if (test == SUSPEND_TEST_NONE)
suspend_via_rtcwake(state);
@@ -1031,7 +1036,7 @@ void igt_system_suspend_autoresume(enum igt_suspend_state state,
if (orig_mem_sleep)
set_mem_sleep(power_dir, orig_mem_sleep);
- set_suspend_test(power_dir, orig_test);
+ set_pm_test(power_dir, orig_test);
close(power_dir);
}