Commit 41339307 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] watchdog write() return value fixes

From: gleb@nbase.co.il (Gleb Natapov)

There is inconsistency in fops->write() implementation in different
watchdog drivers.  Some of them return number of bytes written while others
return 1.

I think the correct implementation should always return number of bytes
written (we examine all the buffer after all) otherwise "echo V >
/dev/watchdog" doesn't work as expected (it doesn't stop watchdog).
parent a7380b60
......@@ -232,9 +232,8 @@ static ssize_t i810tco_write (struct file *file, const char *data,
/* someone wrote to us, we should reload the timer */
tco_timer_reload ();
return 1;
}
return 0;
return len;
}
static int i810tco_ioctl (struct inode *inode, struct file *file,
......
......@@ -161,9 +161,8 @@ ibwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
}
}
ibwdt_ping();
return 1;
}
return 0;
return count;
}
static int
......
......@@ -113,9 +113,8 @@ static ssize_t indydog_write(struct file *file, const char *data, size_t len, lo
}
}
indydog_ping();
return 1;
}
return 0;
return len;
}
static int indydog_ioctl(struct inode *inode, struct file *file,
......
......@@ -343,10 +343,9 @@ static ssize_t zf_write(struct file *file, const char *buf, size_t count,
next_heartbeat = jiffies + ZF_USER_TIMEO;
dprintk("user ping at %ld\n", jiffies);
return 1;
}
return 0;
return count;
}
static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
......
......@@ -156,9 +156,8 @@ static ssize_t mixcomwd_write(struct file *file, const char *data, size_t len, l
}
}
mixcomwd_ping();
return 1;
}
return 0;
return len;
}
static int mixcomwd_ioctl(struct inode *inode, struct file *file,
......
......@@ -419,9 +419,8 @@ static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
}
}
pcwd_send_heartbeat();
return 1;
}
return 0;
return len;
}
static int pcwd_open(struct inode *ino, struct file *filep)
......
......@@ -106,7 +106,7 @@ static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len,
OSMR3 = OSCR + pre_margin;
}
return len ? 1 : 0;
return len;
}
static struct watchdog_info ident = {
......
......@@ -155,9 +155,8 @@ static ssize_t softdog_write(struct file *file, const char *data, size_t len, lo
}
}
mod_timer(&watchdog_ticktock, jiffies+(soft_margin*HZ));
return 1;
}
return 0;
return len;
}
static int softdog_ioctl(struct inode *inode, struct file *file,
......
......@@ -265,9 +265,8 @@ static ssize_t wdt_write(struct file *file, const char *buf, size_t count, loff_
}
}
wdt_ping();
return 1;
}
return 0;
return count;
}
/**
......
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