From 7d01689330394e7105d6e34b9c67cac2caf46ce2 Mon Sep 17 00:00:00 2001 From: Andrey Gusakov Date: Wed, 5 Jul 2017 20:18:10 +0300 Subject: video: tc358767: optimize aux i2c bus checks Move common check to tc_aux_i2c_xfer Remove duplicated check from tc_aux_i2c_write Signed-off-by: Andrey Gusakov Signed-off-by: Lucas Stach --- drivers/video/tc358767.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/video/tc358767.c b/drivers/video/tc358767.c index c2222d9162..cd56bb4f43 100644 --- a/drivers/video/tc358767.c +++ b/drivers/video/tc358767.c @@ -418,9 +418,6 @@ static int tc_aux_i2c_read(struct tc_data *tc, struct i2c_msg *msg) int ret; u32 tmp; - if (msg->flags & I2C_M_DATA_ONLY) - return -EINVAL; - ret = tc_aux_wait_busy(tc, 100); if (ret) goto err; @@ -459,14 +456,6 @@ static int tc_aux_i2c_write(struct tc_data *tc, struct i2c_msg *msg) int ret; u32 tmp = 0; - if (msg->flags & I2C_M_DATA_ONLY) - return -EINVAL; - - if (msg->len > 16) { - dev_err(tc->dev, "this bus support max 16 bytes per transfer\n"); - return -EINVAL; - } - ret = tc_aux_wait_busy(tc, 100); if (ret) goto err; @@ -512,6 +501,8 @@ static int tc_aux_i2c_xfer(struct i2c_adapter *adapter, dev_err(tc->dev, "this bus support max 16 bytes per transfer\n"); return -EINVAL; } + if (msgs[i].flags & I2C_M_DATA_ONLY) + return -EINVAL; } /* read/write data */ -- cgit v1.2.3