VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / char / watchdog / pcwd_usb.c
index 0f4c1ca..cdfe0db 100644 (file)
@@ -326,13 +326,9 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
  *     /dev/watchdog handling
  */
 
-static ssize_t usb_pcwd_write(struct file *file, const char *data,
+static ssize_t usb_pcwd_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) {
@@ -361,6 +357,8 @@ static ssize_t usb_pcwd_write(struct file *file, const char *data,
 static int usb_pcwd_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 |
@@ -371,12 +369,12 @@ static int usb_pcwd_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_GETTEMP:
                {
@@ -385,7 +383,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
                        if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
                                return -EFAULT;
 
-                       return put_user(temperature, (int *) arg);
+                       return put_user(temperature, p);
                }
 
                case WDIOC_KEEPALIVE:
@@ -396,7 +394,7 @@ static int usb_pcwd_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) {
@@ -416,7 +414,7 @@ static int usb_pcwd_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 (usb_pcwd_set_heartbeat(usb_pcwd_device, new_heartbeat))
@@ -427,7 +425,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
                }
 
                case WDIOC_GETTIMEOUT:
-                       return put_user(heartbeat, (int *)arg);
+                       return put_user(heartbeat, p);
 
                default:
                        return -ENOIOCTLCMD;
@@ -443,7 +441,7 @@ static int usb_pcwd_open(struct inode *inode, struct file *file)
        /* Activate */
        usb_pcwd_start(usb_pcwd_device);
        usb_pcwd_keepalive(usb_pcwd_device);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_pcwd_release(struct inode *inode, struct file *file)
@@ -466,19 +464,15 @@ static int usb_pcwd_release(struct inode *inode, struct file *file)
  *     /dev/temperature handling
  */
 
-static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
+static ssize_t usb_pcwd_temperature_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 (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
                return -EFAULT;
 
-       if (copy_to_user (data, &temperature, 1))
+       if (copy_to_user(data, &temperature, 1))
                return -EFAULT;
 
        return 1;
@@ -486,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char *data,
 
 static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
 {
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)