X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Fwatchdog%2Fpcwd_pci.c;h=7216e4836193fd87b1d77266f4ad516c8bde6518;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=0b3c727e5e0df833a6a8b3eb488d7a2bdfc0070c;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 0b3c727e5..7216e4836 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c @@ -258,13 +258,9 @@ static int pcipcwd_get_temperature(int *temperature) * /dev/watchdog handling */ -static ssize_t pcipcwd_write(struct file *file, const char *data, +static ssize_t pcipcwd_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) { @@ -293,6 +289,8 @@ static ssize_t pcipcwd_write(struct file *file, const char *data, static int pcipcwd_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_OVERHEAT | WDIOF_CARDRESET | @@ -305,7 +303,7 @@ static int pcipcwd_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: @@ -314,11 +312,11 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, pcipcwd_get_status(&status); - return put_user(status, (int *) arg); + return put_user(status, p); } case WDIOC_GETBOOTSTATUS: - return put_user(pcipcwd_private.boot_status, (int *) arg); + return put_user(pcipcwd_private.boot_status, p); case WDIOC_GETTEMP: { @@ -327,7 +325,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, if (pcipcwd_get_temperature(&temperature)) return -EFAULT; - return put_user(temperature, (int *) arg); + return put_user(temperature, p); } case WDIOC_KEEPALIVE: @@ -338,7 +336,7 @@ static int pcipcwd_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) { @@ -363,7 +361,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, { int new_heartbeat; - if (get_user(new_heartbeat, (int *) arg)) + if (get_user(new_heartbeat, p)) return -EFAULT; if (pcipcwd_set_heartbeat(new_heartbeat)) @@ -374,7 +372,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, } case WDIOC_GETTIMEOUT: - return put_user(heartbeat, (int *)arg); + return put_user(heartbeat, p); default: return -ENOIOCTLCMD; @@ -390,7 +388,7 @@ static int pcipcwd_open(struct inode *inode, struct file *file) /* Activate */ pcipcwd_start(); pcipcwd_keepalive(); - return 0; + return nonseekable_open(inode, file); } static int pcipcwd_release(struct inode *inode, struct file *file) @@ -413,15 +411,11 @@ static int pcipcwd_release(struct inode *inode, struct file *file) * /dev/temperature handling */ -static ssize_t pcipcwd_temp_read(struct file *file, char *data, +static ssize_t pcipcwd_temp_read(struct file *file, char __user *data, size_t len, loff_t *ppos) { int temperature; - /* Can't seek (pwrite) on this device */ - if (ppos != &file->f_pos) - return -ESPIPE; - if (pcipcwd_get_temperature(&temperature)) return -EFAULT; @@ -436,7 +430,7 @@ static int pcipcwd_temp_open(struct inode *inode, struct file *file) if (!pcipcwd_private.supports_temp) return -ENODEV; - return 0; + return nonseekable_open(inode, file); } static int pcipcwd_temp_release(struct inode *inode, struct file *file)