From 3ba3774b8c433fe9e91158d65cf2324ff0c5a15d Mon Sep 17 00:00:00 2001 From: Roland Stigge Date: Fri, 20 Apr 2012 21:55:29 +0200 Subject: watchdog: Device tree support for pnx4008-wdt This patch adds device tree support to pnx4008-wdt.c Signed-off-by: Roland Stigge Reviewed-by: Arnd Bergmann Signed-off-by: Wim Van Sebroeck --- Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt (limited to 'Documentation') diff --git a/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt new file mode 100644 index 000000000000..7c7f6887c796 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/pnx4008-wdt.txt @@ -0,0 +1,13 @@ +* NXP PNX watchdog timer + +Required properties: +- compatible: must be "nxp,pnx4008-wdt" +- reg: physical base address of the controller and length of memory mapped + region. + +Example: + + watchdog@4003C000 { + compatible = "nxp,pnx4008-wdt"; + reg = <0x4003C000 0x1000>; + }; -- cgit From 2deca7365582b7568dbdd2c3d9eef7ac17d41fd6 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Mon, 14 May 2012 14:33:37 +0530 Subject: Documentation/watchdog: Fix a small typo Signed-off-by: Devendra Naga Signed-off-by: Wim Van Sebroeck --- Documentation/watchdog/watchdog-kernel-api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/watchdog/watchdog-kernel-api.txt b/Documentation/watchdog/watchdog-kernel-api.txt index 227f6cd0e5fa..25fe4304f2fc 100644 --- a/Documentation/watchdog/watchdog-kernel-api.txt +++ b/Documentation/watchdog/watchdog-kernel-api.txt @@ -59,7 +59,7 @@ It contains following fields: * bootstatus: status of the device after booting (reported with watchdog WDIOF_* status bits). * driver_data: a pointer to the drivers private data of a watchdog device. - This data should only be accessed via the watchdog_set_drvadata and + This data should only be accessed via the watchdog_set_drvdata and watchdog_get_drvdata routines. * status: this field contains a number of status bits that give extra information about the status of the device (Like: is the watchdog timer -- cgit From 3c2a6186c1a69d647e3a48ad3f7f9078c451111e Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Mon, 14 May 2012 23:42:02 +0530 Subject: Documentation/watchdog: close the fd when cmdline arg given in the watchdog test code, the ioctl is performed on the watchdog device and just doing exit(0) so we leak a filedescripor. Signed-off-by: Devendra Naga Signed-off-by: Wim Van Sebroeck --- Documentation/watchdog/src/watchdog-test.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Documentation') diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c index 63fdc34ceb98..23084f221279 100644 --- a/Documentation/watchdog/src/watchdog-test.c +++ b/Documentation/watchdog/src/watchdog-test.c @@ -47,18 +47,18 @@ int main(int argc, char *argv[]) ioctl(fd, WDIOC_SETOPTIONS, &flags); fprintf(stderr, "Watchdog card disabled.\n"); fflush(stderr); - exit(0); + goto end; } else if (!strncasecmp(argv[1], "-e", 2)) { flags = WDIOS_ENABLECARD; ioctl(fd, WDIOC_SETOPTIONS, &flags); fprintf(stderr, "Watchdog card enabled.\n"); fflush(stderr); - exit(0); + goto end; } else { fprintf(stderr, "-d to disable, -e to enable.\n"); fprintf(stderr, "run by itself to tick the card.\n"); fflush(stderr); - exit(0); + goto end; } } else { fprintf(stderr, "Watchdog Ticking Away!\n"); @@ -69,4 +69,7 @@ int main(int argc, char *argv[]) keep_alive(); sleep(1); } +end: + close(fd); + return 0; } -- cgit From cad19fa66469d2a745fae0c168833d5d33d64489 Mon Sep 17 00:00:00 2001 From: Devendra Naga Date: Thu, 17 May 2012 15:07:48 +0530 Subject: Documentation/watchdog: Fix the file descriptor leak when no cmdline arg given we start a infinite loop when user gives ./watchdog-test, and when user ctrl + c's the program, we just exit immeadiately with out closing the filedescriptor of the watchdog device. a signal handler is used to do the job of closing the filedescriptor and exiting the program. Signed-off-by: Devendra Naga Signed-off-by: Wim Van Sebroeck --- Documentation/watchdog/src/watchdog-test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Documentation') diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c index 23084f221279..73ff5cc93e05 100644 --- a/Documentation/watchdog/src/watchdog-test.c +++ b/Documentation/watchdog/src/watchdog-test.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,14 @@ static void keep_alive(void) * The main program. Run the program with "-d" to disable the card, * or "-e" to enable the card. */ + +void term(int sig) +{ + close(fd); + fprintf(stderr, "Stopping watchdog ticks...\n"); + exit(0); +} + int main(int argc, char *argv[]) { int flags; @@ -65,6 +74,8 @@ int main(int argc, char *argv[]) fflush(stderr); } + signal(SIGINT, term); + while(1) { keep_alive(); sleep(1); -- cgit