]> git.hungrycats.org Git - linux/commitdiff
[WATCHDOG] SC1200WDT nowayout fixes from 2.4
authorDave Jones <davej@codemonkey.org.uk>
Fri, 10 Jan 2003 02:14:01 +0000 (01:14 -0100)
committerDave Jones <davej@tetrachloride.(none)>
Fri, 10 Jan 2003 02:14:01 +0000 (01:14 -0100)
drivers/char/watchdog/sc1200wdt.c

index 0047475330da373ec24e5d31f84b5b7cda8960c8..005cdaa5c4cfa7642a158b1c8e8e6700be641b79 100644 (file)
@@ -22,6 +22,8 @@
  *              <rob@osinvestor.com>   Return proper status instead of temperature warning
  *                                     Add WDIOC_GETBOOTSTATUS and WDIOC_SETOPTIONS ioctls
  *                                     Fix CONFIG_WATCHDOG_NOWAYOUT
+ *     20020530 Joel Becker            Add Matt Domsch's nowayout module option
+ *
  */
 
 #include <linux/config.h>
@@ -39,6 +41,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/isapnp.h>
+#include <linux/pci.h>
 
 #define SC1200_MODULE_VER      "build 20020303"
 #define SC1200_MODULE_NAME     "sc1200wdt"
@@ -86,6 +89,15 @@ MODULE_PARM_DESC(io, "io port");
 MODULE_PARM(timeout, "i");
 MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1");
 
+#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)");
+
 
 
 /* Read from Data Register */
@@ -161,9 +173,9 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
 {
        int new_timeout;
        static struct watchdog_info ident = {
-               options:                WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
-               firmware_version:       0,
-               identity:               "PC87307/PC97307"
+               .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
+               .firmware_version = 0,
+               .identity = "PC87307/PC97307"
        };
 
        switch (cmd) {
@@ -246,20 +258,21 @@ static ssize_t sc1200wdt_write(struct file *file, const char *data, size_t len,
                return -ESPIPE;
        
        if (len) {
-#ifndef CONFIG_WATCHDOG_NOWAYOUT
-               size_t i;
+               if (!nowayout) {
+                       size_t i;
 
-               expect_close = 0;
+                       expect_close = 0;
 
-               for (i = 0; i != len; i++)
-               {
-                       char c;
-                       if(get_user(c, data+i))
-                               return -EFAULT;
-                       if (c == 'V')
-                               expect_close = 42;
+                       for (i = 0; i != len; i++) {
+                               char c;
+
+                               if (get_user(c, data+i))
+                                       return -EFAULT;
+                               if (c == 'V')
+                                       expect_close = 42;
+                       }
                }
-#endif
+
                sc1200wdt_write_data(WDTO, timeout);
                return len;
        }