]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] watchdog nowayout for acquirewdt
authorDave Jones <davej@suse.de>
Wed, 3 Apr 2002 03:23:28 +0000 (19:23 -0800)
committerDave Jones <davej@suse.de>
Wed, 3 Apr 2002 03:23:28 +0000 (19:23 -0800)
Originally from Matt Domsch.
Adds a nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
From 2.4

drivers/char/acquirewdt.c

index 37a3420c9285ada082e338480c4f529f8aef34ed..a7ea69594e03fdaba1b258a5acdfaef04c1f167c 100644 (file)
@@ -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>
@@ -50,8 +53,14 @@ static spinlock_t acq_lock;
 #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.
@@ -126,10 +135,13 @@ static int acq_open(struct inode *inode, struct file *file)
                                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);
@@ -144,9 +156,9 @@ static int acq_close(struct inode *inode, struct file *file)
        if(minor(inode->i_rdev)==WATCHDOG_MINOR)
        {
                spin_lock(&acq_lock);
-#ifndef CONFIG_WATCHDOG_NOWAYOUT       
-               inb_p(WDT_STOP);
-#endif         
+               if (!nowayout) {
+                       inb_p(WDT_STOP);
+               }
                acq_is_open=0;
                spin_unlock(&acq_lock);
        }