Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pranay Samala <pranay.samala@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, kunal1.joshi@intel.com,
	sameer.lattannavar@intel.com, pranay.samala@intel.com
Subject: [PATCH i-g-t v3 1/5] lib/igt_sysfs: Usage of Original debug mask to read/reset
Date: Tue,  1 Apr 2025 14:50:11 +0530	[thread overview]
Message-ID: <20250401092015.818465-2-pranay.samala@intel.com> (raw)
In-Reply-To: <20250401092015.818465-1-pranay.samala@intel.com>

Original debug mask holds the mask before the test and will be
used to reset the debug mask post test.

Fixes: 56b91193b825 ("lib/igt_sysfs: Implement dynamic adjustment of debug log level")
Signed-off-by: Pranay Samala <pranay.samala@intel.com>
---
 lib/igt_sysfs.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 2e4c2ee63..9643aab43 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -443,7 +443,7 @@ int igt_sysfs_drm_module_params_open(void)
 	return open(path, O_RDONLY);
 }
 
-static int log_level = -1;
+static int original_debug_mask = -1;
 
 /**
  * igt_drm_debug_level_get:
@@ -458,8 +458,8 @@ int igt_drm_debug_level_get(int dir)
 {
 	char buf[20];
 
-	if (log_level >= 0)
-		return log_level;
+	if (original_debug_mask >= 0)
+		return original_debug_mask;
 
 	if (igt_sysfs_read(dir, "debug", buf, sizeof(buf) - 1) < 0)
 		return -1;
@@ -479,15 +479,15 @@ void igt_drm_debug_level_reset(void)
 	char buf[20];
 	int dir;
 
-	if (log_level < 0)
+	if (original_debug_mask < 0)
 		return;
 
 	dir = igt_sysfs_drm_module_params_open();
 	if (dir < 0)
 		return;
 
-	igt_debug("Resetting DRM debug level to %d\n", log_level);
-	snprintf(buf, sizeof(buf), "%d", log_level);
+	igt_debug("Resetting DRM debug level to %d\n", original_debug_mask);
+	snprintf(buf, sizeof(buf), "%d", original_debug_mask);
 	igt_assert(igt_sysfs_set(dir, "debug", buf));
 
 	close(dir);
@@ -513,8 +513,8 @@ void igt_drm_debug_level_update(unsigned int new_log_level)
 	if (dir < 0)
 		return;
 
-	log_level = igt_drm_debug_level_get(dir);
-	if (log_level < 0) {
+	original_debug_mask = igt_drm_debug_level_get(dir);
+	if (original_debug_mask < 0) {
 		close(dir);
 		return;
 	}
-- 
2.34.1


  reply	other threads:[~2025-04-01  9:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01  9:20 [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Pranay Samala
2025-04-01  9:20 ` Pranay Samala [this message]
2025-04-23 11:49   ` [i-g-t,v3,1/5] lib/igt_sysfs: Usage of Original debug mask to read/reset Joshi, Kunal1
2025-04-01  9:20 ` [PATCH i-g-t v3 2/5] lib/igt_sysfs: Rename debug level APIs/variables to debug mask Pranay Samala
2025-04-23 11:56   ` [i-g-t,v3,2/5] " Joshi, Kunal1
2025-04-01  9:20 ` [PATCH i-g-t v3 3/5] lib/igt_sysfs: Update new debug mask requested by user Pranay Samala
2025-04-01  9:20 ` [PATCH i-g-t v3 4/5] tests/kms: Add parse_bitmask support for user Pranay Samala
2025-04-03 15:18   ` Jani Nikula
2025-04-23 12:23   ` [i-g-t,v3,4/5] " Joshi, Kunal1
2025-04-01  9:20 ` [PATCH i-g-t v3 5/5] lib/igt_sysfs: Move igt_exit_handler into test Pranay Samala
2025-04-01 10:04 ` [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Samala, Pranay
2025-04-01 12:24 ` ✗ i915.CI.BAT: failure for " Patchwork
2025-04-01 12:30 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-01 14:39 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-06 22:24 ` Patchwork

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=20250401092015.818465-2-pranay.samala@intel.com \
    --to=pranay.samala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=karthik.b.s@intel.com \
    --cc=kunal1.joshi@intel.com \
    --cc=sameer.lattannavar@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