Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t 2/3] lib/igt_aux: Name function according to sysfs file
Date: Fri,  3 May 2024 15:47:44 -0700	[thread overview]
Message-ID: <20240503224745.14890-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20240503224745.14890-1-lucas.demarchi@intel.com>

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.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/igt_aux.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index d6aeb876b..398665999 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,14 @@ 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 +1013,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 +1025,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 +1035,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);
 }
 
-- 
2.43.0


  reply	other threads:[~2024-05-03 22:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 22:47 [PATCH i-g-t 1/3] tests/intel/xe_pm: Reword *-basic description Lucas De Marchi
2024-05-03 22:47 ` Lucas De Marchi [this message]
2024-05-06 14:12   ` [PATCH i-g-t 2/3] lib/igt_aux: Name function according to sysfs file Rodrigo Vivi
2024-05-03 22:47 ` [PATCH i-g-t 3/3] tests/intel/xe_pm: S4 to go up to devices only Lucas De Marchi
2024-05-06 14:14   ` Rodrigo Vivi
2024-05-06 16:48     ` Lucas De Marchi
2024-05-03 23:28 ` ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] tests/intel/xe_pm: Reword *-basic description Patchwork
2024-05-04  0:10 ` ✓ CI.xeBAT: " Patchwork
2024-05-04  2:22 ` ✗ CI.xeFULL: failure " Patchwork
2024-05-04 11:51 ` ✗ Fi.CI.IGT: " Patchwork
2024-05-06 14:10 ` [PATCH i-g-t 1/3] " Rodrigo Vivi
2024-05-06 20:05 ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240503224745.14890-2-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox