VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / char / watchdog / pcwd_pci.c
index 0b3c727..7216e48 100644 (file)
@@ -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)