Skip to content

Commit

Permalink
i2c: Use put_user instead of copy_to_user where possible
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Dec 10, 2006
1 parent 813e30e commit 2c003e8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/i2c/i2c-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2c003e8

Please sign in to comment.