[PATCH v1 07/10] video: tc358767: optimize aux i2c bus checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move common check to tc_aux_i2c_xfer
Remove duplicated check from tc_aux_i2c_write

Signed-off-by: Andrey Gusakov <andrey.gusakov@xxxxxxxxxxxxxxxxxx>
---
 drivers/video/tc358767.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/video/tc358767.c b/drivers/video/tc358767.c
index c2222d916..cd56bb4f4 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 */
-- 
2.13.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux