Commit 97cb93ec authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[WATCHDOG] Advantech fixes from 2.4

parent 0e02e111
...@@ -99,10 +99,22 @@ advwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos) ...@@ -99,10 +99,22 @@ advwdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
return -ESPIPE; return -ESPIPE;
if (count) { if (count) {
if (!nowayout) {
size_t i;
adv_expect_close = 0;
for (i = 0; i != count; i++) {
char c;
if (get_user(c, buf+i))
return -EFAULT;
if (c == 'V')
adv_expect_close = 42;
}
}
advwdt_ping(); advwdt_ping();
return 1;
} }
return 0; return count;
} }
static ssize_t static ssize_t
...@@ -116,9 +128,11 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -116,9 +128,11 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
static struct watchdog_info ident = { static struct watchdog_info ident = {
WDIOF_KEEPALIVEPING, 1, "Advantech WDT" .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = "Advantech WDT"
}; };
switch (cmd) { switch (cmd) {
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident))) if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
......
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