VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / char / watchdog / w83627hf_wdt.c
index 7a12930..813c970 100644 (file)
@@ -142,12 +142,8 @@ wdt_set_heartbeat(int t)
 }
 
 static ssize_t
-wdt_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
@@ -171,6 +167,8 @@ static int
 wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
          unsigned long arg)
 {
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
        int new_timeout;
        static struct watchdog_info ident = {
                .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
@@ -180,20 +178,20 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
-         if (copy_to_user((struct watchdog_info *)arg, &ident, sizeof(ident)))
+         if (copy_to_user(argp, &ident, sizeof(ident)))
            return -EFAULT;
          break;
 
        case WDIOC_GETSTATUS:
        case WDIOC_GETBOOTSTATUS:
-         return put_user(0, (int *)arg);
+         return put_user(0, p);
 
        case WDIOC_KEEPALIVE:
          wdt_ping();
          break;
 
        case WDIOC_SETTIMEOUT:
-         if (get_user(new_timeout, (int *)arg))
+         if (get_user(new_timeout, p))
                  return -EFAULT;
          if (wdt_set_heartbeat(new_timeout))
                  return -EINVAL;
@@ -201,13 +199,13 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
          /* Fall */
 
        case WDIOC_GETTIMEOUT:
-         return put_user(timeout, (int *)arg);
+         return put_user(timeout, p);
 
        case WDIOC_SETOPTIONS:
        {
          int options, retval = -EINVAL;
 
-         if (get_user(options, (int *)arg))
+         if (get_user(options, p))
            return -EFAULT;
 
          if (options & WDIOS_DISABLECARD) {
@@ -239,7 +237,7 @@ wdt_open(struct inode *inode, struct file *file)
         */
 
        wdt_ping();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int