]> git.hungrycats.org Git - linux/commitdiff
[PATCH] watchdog nowayout for machzwd
authorDave Jones <davej@suse.de>
Wed, 3 Apr 2002 04:00:02 +0000 (20:00 -0800)
committerDave Jones <davej@suse.de>
Wed, 3 Apr 2002 04:00:02 +0000 (20:00 -0800)
Originally from Matt Domsch.
Adds a nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
From 2.4

drivers/char/machzwd.c

index 8765b677a6dc879d1cc30f17502ef6df373b2424..85ba8321a564b8d84f6cc4643583dff39604c8dc 100644 (file)
@@ -24,6 +24,8 @@
  *  a system RESET and it starts wd#2 that unconditionaly will RESET 
  *  the system when the counter reaches zero.
  *
+ *  14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com>
+ *      Added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
  */
 
 #include <linux/config.h>
@@ -103,6 +105,15 @@ MODULE_LICENSE("GPL");
 MODULE_PARM(action, "i");
 MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*)  1 = SMI  2 = NMI  3 = SCI");
 
+#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)");
+
 #define PFX "machzwd"
 
 static struct watchdog_info zf_info = {
@@ -307,23 +318,23 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
  * no need to check for close confirmation
  * no way to disable watchdog ;)
  */
-#ifndef CONFIG_WATCHDOG_NOWAYOUT
-               size_t ofs;
-
-               /* 
-                * note: just in case someone wrote the magic character
-                * five months ago...
-                */
-               zf_expect_close = 0;
-
-               /* now scan */
-               for(ofs = 0; ofs != count; ofs++){
-                       if(buf[ofs] == 'V'){
-                               zf_expect_close = 1;
-                               dprintk("zf_expect_close 1\n");
+               if (!nowayout) {
+                       size_t ofs;
+                       
+                       /* 
+                        * note: just in case someone wrote the magic character
+                        * five months ago...
+                        */
+                       zf_expect_close = 0;
+                       
+                       /* now scan */
+                       for(ofs = 0; ofs != count; ofs++){
+                               if(buf[ofs] == 'V'){
+                                       zf_expect_close = 1;
+                                       dprintk("zf_expect_close 1\n");
+                               }
                        }
                }
-#endif
                /*
                 * Well, anyhow someone wrote to us,
                 * we should return that favour
@@ -386,9 +397,9 @@ static int zf_open(struct inode *inode, struct file *file)
                                return -EBUSY;
                        }
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-                       MOD_INC_USE_COUNT;
-#endif
+                       if (nowayout) {
+                               MOD_INC_USE_COUNT;
+                       }
                        zf_is_open = 1;
 
                        spin_unlock(&zf_lock);