Commit 6c26f9e2 authored by Dave Jones's avatar Dave Jones

[PATCH] watchdog nowayout for acquirewdt

Originally from Matt Domsch.
Adds a nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
From 2.4
parent 97752344
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* *
* (c) Copyright 1995 Alan Cox <alan@redhat.com> * (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> #include <linux/config.h>
...@@ -50,8 +53,14 @@ static spinlock_t acq_lock; ...@@ -50,8 +53,14 @@ static spinlock_t acq_lock;
#define WDT_STOP 0x43 #define WDT_STOP 0x43
#define WDT_START 0x443 #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. * Kernel methods.
...@@ -126,10 +135,13 @@ static int acq_open(struct inode *inode, struct file *file) ...@@ -126,10 +135,13 @@ static int acq_open(struct inode *inode, struct file *file)
spin_unlock(&acq_lock); spin_unlock(&acq_lock);
return -EBUSY; return -EBUSY;
} }
if (nowayout) {
MOD_INC_USE_COUNT;
}
/* /*
* Activate * Activate
*/ */
acq_is_open=1; acq_is_open=1;
inb_p(WDT_START); inb_p(WDT_START);
spin_unlock(&acq_lock); spin_unlock(&acq_lock);
...@@ -144,9 +156,9 @@ static int acq_close(struct inode *inode, struct file *file) ...@@ -144,9 +156,9 @@ static int acq_close(struct inode *inode, struct file *file)
if(minor(inode->i_rdev)==WATCHDOG_MINOR) if(minor(inode->i_rdev)==WATCHDOG_MINOR)
{ {
spin_lock(&acq_lock); spin_lock(&acq_lock);
#ifndef CONFIG_WATCHDOG_NOWAYOUT if (!nowayout) {
inb_p(WDT_STOP); inb_p(WDT_STOP);
#endif }
acq_is_open=0; acq_is_open=0;
spin_unlock(&acq_lock); spin_unlock(&acq_lock);
} }
......
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