X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fchar%2Fwatchdog%2Falim1535_wdt.c;h=35dcbf8be7d1c93054a2148b0890be6a2b049b79;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=9a3207d81894dd25cb785204b0d4d131895248c5;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index 9a3207d81..35dcbf8be 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c @@ -138,13 +138,9 @@ static int ali_settimer(int t) * the next close to turn off the watchdog. */ -static ssize_t ali_write(struct file *file, const char *data, +static ssize_t ali_write(struct file *file, const char __user *data, size_t len, loff_t * ppos) { - /* Can't seek (pwrite) on this device */ - if (ppos != &file->f_pos) - return -ESPIPE; - /* See if we got the magic character 'V' and reload the timer */ if (len) { if (!nowayout) { @@ -184,6 +180,8 @@ static ssize_t ali_write(struct file *file, const char *data, static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { + void __user *argp = (void __user *)arg; + int __user *p = argp; static struct watchdog_info ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | @@ -194,12 +192,12 @@ static int ali_ioctl(struct inode *inode, struct file *file, switch (cmd) { case WDIOC_GETSUPPORT: - return copy_to_user((struct watchdog_info *) arg, &ident, + return copy_to_user(argp, &ident, sizeof (ident)) ? -EFAULT : 0; case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: - return put_user(0, (int *) arg); + return put_user(0, p); case WDIOC_KEEPALIVE: ali_keepalive(); @@ -209,7 +207,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, { int new_options, retval = -EINVAL; - if (get_user (new_options, (int *) arg)) + if (get_user (new_options, p)) return -EFAULT; if (new_options & WDIOS_DISABLECARD) { @@ -229,7 +227,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, { int new_timeout; - if (get_user(new_timeout, (int *) arg)) + if (get_user(new_timeout, p)) return -EFAULT; if (ali_settimer(new_timeout)) @@ -240,7 +238,7 @@ static int ali_ioctl(struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(timeout, (int *)arg); + return put_user(timeout, p); default: return -ENOIOCTLCMD; @@ -264,7 +262,7 @@ static int ali_open(struct inode *inode, struct file *file) /* Activate */ ali_start(); - return 0; + return nonseekable_open(inode, file); } /*