aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c22
-rw-r--r--drivers/i2c/i2c-dev.c14
2 files changed, 12 insertions, 24 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5e58b5641a35..e73d58c43f38 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -931,28 +931,6 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count)
931} 931}
932EXPORT_SYMBOL(i2c_master_recv); 932EXPORT_SYMBOL(i2c_master_recv);
933 933
934int i2c_control(struct i2c_client *client,
935 unsigned int cmd, unsigned long arg)
936{
937 int ret = 0;
938 struct i2c_adapter *adap = client->adapter;
939
940 dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg);
941 switch (cmd) {
942 case I2C_RETRIES:
943 adap->retries = arg;
944 break;
945 case I2C_TIMEOUT:
946 adap->timeout = arg;
947 break;
948 default:
949 if (adap->algo->algo_control!=NULL)
950 ret = adap->algo->algo_control(adap,cmd,arg);
951 }
952 return ret;
953}
954EXPORT_SYMBOL(i2c_control);
955
956/* ---------------------------------------------------- 934/* ----------------------------------------------------
957 * the i2c address scanning function 935 * the i2c address scanning function
958 * Will not work for 10-bit addresses! 936 * Will not work for 10-bit addresses!
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index df6e14c192d6..5a15e50748de 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -354,9 +354,19 @@ static int i2cdev_ioctl(struct inode *inode, struct file *file,
354 return -EFAULT; 354 return -EFAULT;
355 } 355 }
356 return res; 356 return res;
357 357 case I2C_RETRIES:
358 client->adapter->retries = arg;
359 break;
360 case I2C_TIMEOUT:
361 client->adapter->timeout = arg;
362 break;
358 default: 363 default:
359 return i2c_control(client,cmd,arg); 364 /* NOTE: returning a fault code here could cause trouble
365 * in buggy userspace code. Some old kernel bugs returned
366 * zero in this case, and userspace code might accidentally
367 * have depended on that bug.
368 */
369 return -ENOTTY;
360 } 370 }
361 return 0; 371 return 0;
362} 372}