Skip to content

Commit 4c85609

Browse files
masahir0yWolfram Sang
authored andcommitted
i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP
This driver currently emits a STOP if the next message is not I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR ioctl, where read/write transactions are combined without STOP between. Issue STOP only when the message is the last one _or_ flagged with I2C_M_STOP. Fixes: 6a62974 ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent 38f5d8d commit 4c85609

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/i2c/busses/i2c-uniphier-f.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap,
401401
return ret;
402402

403403
for (msg = msgs; msg < emsg; msg++) {
404-
/* If next message is read, skip the stop condition */
405-
bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
406-
/* but, force it if I2C_M_STOP is set */
407-
if (msg->flags & I2C_M_STOP)
408-
stop = true;
404+
/* Emit STOP if it is the last message or I2C_M_STOP is set. */
405+
bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
409406

410407
ret = uniphier_fi2c_master_xfer_one(adap, msg, stop);
411408
if (ret)

0 commit comments

Comments
 (0)