mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests/watchdog: fix WDIOC_GETSTATUS flag decoding
@ 2026-08-24 16:27 Chun-Cheng Chang
  0 siblings, 0 replies; only message in thread
From: Chun-Cheng Chang @ 2026-08-24 16:27 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Akhilesh Patil, linux-kselftest, linux-kernel, Chun-Cheng Chang

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-24 16:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-24 16:27 [PATCH] selftests/watchdog: fix WDIOC_GETSTATUS flag decoding Chun-Cheng Chang

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®