#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.
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;
}
{
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 */
{
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);
}