Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: watchdog: Add command line option to show watchdog_info

With the new ioctl(WDIOC_GETSUPPORT) call in place, add a command
line option to show the watchdog_info.

Suggested-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

George G. Davis and committed by
Shuah Khan
ce3a6778 8f9577ed

+15 -1
+15 -1
tools/testing/selftests/watchdog/watchdog-test.c
··· 19 19 20 20 int fd; 21 21 const char v = 'V'; 22 - static const char sopts[] = "bdehp:t:Tn:NLf:"; 22 + static const char sopts[] = "bdehp:t:Tn:NLf:i"; 23 23 static const struct option lopts[] = { 24 24 {"bootstatus", no_argument, NULL, 'b'}, 25 25 {"disable", no_argument, NULL, 'd'}, ··· 32 32 {"getpretimeout", no_argument, NULL, 'N'}, 33 33 {"gettimeleft", no_argument, NULL, 'L'}, 34 34 {"file", required_argument, NULL, 'f'}, 35 + {"info", no_argument, NULL, 'i'}, 35 36 {NULL, no_argument, NULL, 0x0} 36 37 }; 37 38 ··· 73 72 printf("Usage: %s [options]\n", progname); 74 73 printf(" -f, --file\t\tOpen watchdog device file\n"); 75 74 printf("\t\t\tDefault is /dev/watchdog\n"); 75 + printf(" -i, --info\t\tShow watchdog_info\n"); 76 76 printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n"); 77 77 printf(" -d, --disable\t\tTurn off the watchdog timer\n"); 78 78 printf(" -e, --enable\t\tTurn on the watchdog timer\n"); ··· 217 215 break; 218 216 case 'f': 219 217 /* Handled above */ 218 + break; 219 + case 'i': 220 + /* 221 + * watchdog_info was obtained as part of file open 222 + * validation. So we just show it here. 223 + */ 224 + oneshot = 1; 225 + printf("watchdog_info:\n"); 226 + printf(" identity:\t\t%s\n", info.identity); 227 + printf(" firmware_version:\t%u\n", 228 + info.firmware_version); 229 + printf(" options:\t\t%08x\n", info.options); 220 230 break; 221 231 222 232 default: