Commit ac8173fa authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[WATCHDOG] wdt nowayout changes from 2.4

parent 685c21cc
......@@ -52,6 +52,7 @@
#include <asm/system.h>
static unsigned long wdt_is_open;
static int expect_close;
/*
* You must set these - there is no sane way to probe for this board.
......@@ -258,8 +259,21 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
if (ppos != &file->f_pos)
return -ESPIPE;
if(count)
{
if(count) {
if (!nowayout) {
size_t i;
/* In case it was set long ago */
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;
}
}
wdt_ping();
return 1;
}
......@@ -317,10 +331,11 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
static struct watchdog_info ident=
{
WDIOF_OVERHEAT|WDIOF_POWERUNDER|WDIOF_POWEROVER
|WDIOF_EXTERN1|WDIOF_EXTERN2|WDIOF_FANFAULT,
1,
"WDT500/501"
.options = WDIOF_OVERHEAT|WDIOF_POWERUNDER|WDIOF_POWEROVER
|WDIOF_EXTERN1|WDIOF_EXTERN2|WDIOF_FANFAULT
|WDIOF_SETTIMEOUT|WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = "WDT500/501"
};
ident.options&=WDT_OPTION_MASK; /* Mask down to the card we have */
......@@ -399,9 +414,11 @@ static int wdt_release(struct inode *inode, struct file *file)
{
if(minor(inode->i_rdev)==WATCHDOG_MINOR)
{
if (!nowayout) {
if (expect_close) {
inb_p(WDT_DC); /* Disable counters */
wdt_ctr_load(2,0); /* 0 length reset pulses now */
} else {
printk(KERN_CRIT "wdt: WDT device closed unexpectedly. WDT will not stop!\n");
}
clear_bit(0, &wdt_is_open);
}
......
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