提交 2c003e8e 编写于 作者: J Jean Delvare 提交者: Jean Delvare

i2c: Use put_user instead of copy_to_user where possible

This speeds up the I2C_FUNCS ioctl by 5 to 8% in my tests.
Signed-off-by: NJean Delvare <khali@linux-fr.org>
Laughed-at-by: NMark M. Hoffman <mhoffman@lightlink.com>
上级 813e30e9
...@@ -193,8 +193,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file, ...@@ -193,8 +193,7 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
return 0; return 0;
case I2C_FUNCS: case I2C_FUNCS:
funcs = i2c_get_functionality(client->adapter); funcs = i2c_get_functionality(client->adapter);
return (copy_to_user((unsigned long __user *)arg, &funcs, return put_user(funcs, (unsigned long __user *)arg);
sizeof(unsigned long)))?-EFAULT:0;
case I2C_RDWR: case I2C_RDWR:
if (copy_from_user(&rdwr_arg, if (copy_from_user(&rdwr_arg,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册