aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Tabi2016-06-21 18:00:15 -0500
committerWim Van Sebroeck2016-07-17 21:02:32 +0200
commit5a2d3de1960260f34da84ac27bdc1345b541f2e8 (patch)
tree1ce58d3c592c88a309402381f97bb082c3002fc3
parentee279c2734b07fb74031b1626b0f097cee9de5c8 (diff)
Documentation/watchdog: add support for magic close to watchdog-test
Some drivers have the WDIOF_MAGICCLOSE set, which means that applications need to write 'V' to the watchdog device before closing, otherwise the driver won't stop the watchdog timer. Signed-off-by: Timur Tabi <timur@codeaurora.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--Documentation/watchdog/src/watchdog-test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c
index b3cc7aa12a72..c69153913722 100644
--- a/Documentation/watchdog/src/watchdog-test.c
+++ b/Documentation/watchdog/src/watchdog-test.c
@@ -13,6 +13,7 @@
#include <linux/watchdog.h>
int fd;
+const char v = 'V';
/*
* This function simply sends an IOCTL to the driver, which in turn ticks
@@ -34,6 +35,7 @@ static void keep_alive(void)
static void term(int sig)
{
+ write(fd, &v, 1);
close(fd);
printf("\nStopping watchdog ticks...\n");
exit(0);
@@ -89,6 +91,7 @@ int main(int argc, char *argv[])
sleep(ping_rate);
}
end:
+ write(fd, &v, 1);
close(fd);
return 0;
}