mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chun-Cheng Chang <frank0988855428@gmail.com>
To: Shuah Khan <shuah@kernel.org>
Cc: Akhilesh Patil <akhilesh@ee.iitb.ac.in>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chun-Cheng Chang <frank0988855428@gmail.com>
Subject: [PATCH] selftests/watchdog: fix WDIOC_GETSTATUS flag decoding
Date: Mon, 24 Aug 2026 16:27:49 +0000	[thread overview]
Message-ID: <20260824162749.1859778-1-frank0988855428@gmail.com> (raw)

The wdiof_status table decodes WDIOC_GETSTATUS results and
watchdog_info.options, both of which use WDIOF_* flags.

It incorrectly contains WDIOS_* flags, which are only valid for
WDIOC_SETOPTIONS. Since the values overlap, status bits can be
reported as enable, disable, or temperature-panic operations.

Replace the WDIOS_* entries with the missing WDIOF_* status flags
and use WDIOF_UNKNOWN consistently.

Fixes: ac7e8d3e4a7c ("selftests/watchdog: add support for WDIOC_GETSTATUS")
Signed-off-by: Chun-Cheng Chang <frank0988855428@gmail.com>
---
 .../selftests/watchdog/watchdog-test.c        | 24 +++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c
index 4f09c5db0c7f..3802649b2944 100644
--- a/tools/testing/selftests/watchdog/watchdog-test.c
+++ b/tools/testing/selftests/watchdog/watchdog-test.c
@@ -106,24 +106,28 @@ struct wdiof_status {
 	const char *status_str;
 };
 
-#define WDIOF_NUM_STATUS 8
+#define WDIOF_NUM_STATUS 12
 
 static const struct wdiof_status wdiof_status[WDIOF_NUM_STATUS] = {
-	{WDIOF_SETTIMEOUT,  "Set timeout (in seconds)"},
-	{WDIOF_MAGICCLOSE,  "Supports magic close char"},
-	{WDIOF_PRETIMEOUT,  "Pretimeout (in seconds), get/set"},
-	{WDIOF_ALARMONLY,  "Watchdog triggers a management or other external alarm not a reboot"},
-	{WDIOF_KEEPALIVEPING,  "Keep alive ping reply"},
-	{WDIOS_DISABLECARD,  "Turn off the watchdog timer"},
-	{WDIOS_ENABLECARD,  "Turn on the watchdog timer"},
-	{WDIOS_TEMPPANIC,  "Kernel panic on temperature trip"},
+	{WDIOF_OVERHEAT, "Reset due to CPU overheat"},
+	{WDIOF_FANFAULT, "Fan failed"},
+	{WDIOF_EXTERN1, "External relay 1"},
+	{WDIOF_EXTERN2, "External relay 2"},
+	{WDIOF_POWERUNDER, "Power bad/power fault"},
+	{WDIOF_CARDRESET, "Card previously reset the CPU"},
+	{WDIOF_POWEROVER, "Power over voltage"},
+	{WDIOF_SETTIMEOUT, "Set timeout (in seconds)"},
+	{WDIOF_MAGICCLOSE, "Supports magic close char"},
+	{WDIOF_PRETIMEOUT, "Pretimeout (in seconds), get/set"},
+	{WDIOF_ALARMONLY, "Watchdog triggers a management or other external alarm not a reboot"},
+	{WDIOF_KEEPALIVEPING, "Keep alive ping reply"},
 };
 
 static void print_status(int flags)
 {
 	int wdiof = 0;
 
-	if (flags == WDIOS_UNKNOWN) {
+	if (flags == WDIOF_UNKNOWN) {
 		printf("Unknown status error from WDIOC_GETSTATUS\n");
 		return;
 	}
-- 
2.53.0


                 reply	other threads:[~2026-08-24 16:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260824162749.1859778-1-frank0988855428@gmail.com \
    --to=frank0988855428@gmail.com \
    --cc=akhilesh@ee.iitb.ac.in \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /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

all inboxes | Powered by JetHome®