patch-2.4.20 linux-2.4.20/drivers/char/acquirewdt.c
Next file: linux-2.4.20/drivers/char/advantechwdt.c
Previous file: linux-2.4.20/drivers/char/Makefile
Back to the patch index
Back to the overall index
- Lines: 97
- Date:
Thu Nov 28 15:53:12 2002
- Orig file:
linux-2.4.19/drivers/char/acquirewdt.c
- Orig date:
Fri Aug 2 17:39:43 2002
diff -urN linux-2.4.19/drivers/char/acquirewdt.c linux-2.4.20/drivers/char/acquirewdt.c
@@ -17,6 +17,9 @@
*
* (c) Copyright 1995 Alan Cox <alan@redhat.com>
*
+ * 14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
+ * Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
+ * Can't add timeout - driver doesn't allow changing value
*/
#include <linux/config.h>
@@ -42,6 +45,7 @@
static int acq_is_open;
static spinlock_t acq_lock;
+static int expect_close = 0;
/*
* You must set these - there is no sane way to probe for this board.
@@ -50,8 +54,14 @@
#define WDT_STOP 0x43
#define WDT_START 0x443
-#define WD_TIMO (100*60) /* 1 minute */
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+static int nowayout = 1;
+#else
+static int nowayout = 0;
+#endif
+MODULE_PARM(nowayout,"i");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
/*
* Kernel methods.
@@ -72,6 +82,21 @@
if(count)
{
+ if (!nowayout)
+ {
+ size_t i;
+
+ expect_close = 0;
+
+ for (i = 0; i != count; i++) {
+ char c;
+ if (get_user(c, buf + i))
+ return -EFAULT;
+ if (c == 'V')
+ expect_close = 1;
+ }
+ }
+
acq_ping();
return 1;
}
@@ -90,7 +115,7 @@
{
static struct watchdog_info ident=
{
- WDIOF_KEEPALIVEPING, 1, "Acquire WDT"
+ WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, 1, "Acquire WDT"
};
switch(cmd)
@@ -126,10 +151,12 @@
spin_unlock(&acq_lock);
return -EBUSY;
}
+ if (nowayout) {
+ MOD_INC_USE_COUNT;
+ }
/*
* Activate
*/
-
acq_is_open=1;
inb_p(WDT_START);
spin_unlock(&acq_lock);
@@ -145,9 +172,14 @@
if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
{
spin_lock(&acq_lock);
-#ifndef CONFIG_WATCHDOG_NOWAYOUT
- inb_p(WDT_STOP);
-#endif
+ if (expect_close)
+ {
+ inb_p(WDT_STOP);
+ }
+ else
+ {
+ printk(KERN_CRIT "WDT closed unexpectedly. WDT will not stop!\n");
+ }
acq_is_open=0;
spin_unlock(&acq_lock);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)