uml: use simple_write_to_buffer()
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 13 Jan 2011 00:59:28 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 16:03:07 +0000 (08:03 -0800)
Simplify write file operation for mmapper by using
simple_write_to_buffer().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/drivers/mmapper_kern.c

index 6bc73f0e8e293dd43d7be0f38d16954b1bba49fb..7e0619c2c2c61531749dc8f22b5612d42d6f5b85 100644 (file)
@@ -37,13 +37,7 @@ static ssize_t mmapper_write(struct file *file, const char __user *buf,
        if (*ppos > mmapper_size)
                return -EINVAL;
 
-       if (count > mmapper_size - *ppos)
-               count = mmapper_size - *ppos;
-
-       if (copy_from_user(&v_buf[*ppos], buf, count))
-               return -EFAULT;
-
-       return count;
+       return simple_write_to_buffer(v_buf, mmapper_size, ppos, buf, count);
 }
 
 static long mmapper_ioctl(struct file *file, unsigned int cmd, unsigned long arg)