summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrey Gusakov <andrey.gusakov@cogentembedded.com>2017-07-05 20:18:10 +0300
committerLucas Stach <l.stach@pengutronix.de>2017-07-06 14:43:17 +0200
commit7d01689330394e7105d6e34b9c67cac2caf46ce2 (patch)
tree4cdc787275597eb4d7a313dcd693fca486569d1a /drivers
parentdd6ba39b3f86d06eec94878301656c0bd4fbf23e (diff)
downloadbarebox-7d01689330394e7105d6e34b9c67cac2caf46ce2.tar.gz
barebox-7d01689330394e7105d6e34b9c67cac2caf46ce2.tar.xz
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 <andrey.gusakov@cogentembedded.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/tc358767.c13
1 files changed, 2 insertions, 11 deletions
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 */