Commit a943a2b2 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] v2.6.6 pcwd.c-keepalive+single_open-patch

- Make pcwd_keepalive return 0 on success.
- /dev/watchdog is single open only: make sure that the atomic that
prevents a second open is cleared only as the last instruction of the
release code.
parent 981a1ad3
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/io.h> #include <asm/io.h>
#define WD_VER "1.16 (03/27/2004)" #define WD_VER "1.16 (06/12/2004)"
#define PFX "pcwd: " #define PFX "pcwd: "
/* /*
...@@ -299,10 +299,11 @@ static int pcwd_stop(void) ...@@ -299,10 +299,11 @@ static int pcwd_stop(void)
return 0; return 0;
} }
static void pcwd_keepalive(void) static int pcwd_keepalive(void)
{ {
/* user land ping */ /* user land ping */
next_heartbeat = jiffies + (heartbeat * HZ); next_heartbeat = jiffies + (heartbeat * HZ);
return 0;
} }
static int pcwd_set_heartbeat(int t) static int pcwd_set_heartbeat(int t)
...@@ -529,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file) ...@@ -529,12 +530,12 @@ static int pcwd_close(struct inode *inode, struct file *file)
{ {
if (expect_close == 42) { if (expect_close == 42) {
pcwd_stop(); pcwd_stop();
atomic_inc( &open_allowed );
} else { } else {
printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n"); printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
pcwd_keepalive(); pcwd_keepalive();
} }
expect_close = 0; expect_close = 0;
atomic_inc( &open_allowed );
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment