i2c: Use put_user instead of copy_to_user where possible
authorJean Delvare <khali@linux-fr.org>
Sun, 10 Dec 2006 20:21:30 +0000 (21:21 +0100)
committerJean Delvare <khali@arrakis.delvare>
Sun, 10 Dec 2006 20:21:30 +0000 (21:21 +0100)
This speeds up the I2C_FUNCS ioctl by 5 to 8% in my tests.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Laughed-at-by: Mark M. Hoffman <mhoffman@lightlink.com>
drivers/i2c/i2c-dev.c

index 2e22a2ffa60631fe640f6127e96b23321a9b0899..d66cefc63df73e2c47ad8ee7fc76fb1cc972cf3f 100644 (file)
@@ -193,8 +193,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
                return 0;
        case I2C_FUNCS:
                funcs = i2c_get_functionality(client->adapter);
-               return (copy_to_user((unsigned long __user *)arg, &funcs,
-                                    sizeof(unsigned long)))?-EFAULT:0;
+               return put_user(funcs, (unsigned long __user *)arg);
 
        case I2C_RDWR:
                if (copy_from_user(&rdwr_arg,