[i2c] [PATCH] i2c: Speed up I2C_FUNCS ioctl
Jean Delvare
khali at linux-fr.org
Fri Nov 10 21:58:01 CET 2006
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: Jean Delvare <khali at linux-fr.org>
---
drivers/i2c/i2c-dev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
--- linux-2.6.19-rc5.orig/drivers/i2c/i2c-dev.c 2006-11-10 21:45:36.000000000 +0100
+++ linux-2.6.19-rc5/drivers/i2c/i2c-dev.c 2006-11-10 21:45:54.000000000 +0100
@@ -192,8 +192,7 @@
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,
--
Jean Delvare
More information about the i2c
mailing list