Skip to content

Commit 38f5d8d

Browse files
masahir0yWolfram Sang
authored andcommitted
i2c: uniphier: 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: dd6fd4a ("i2c: uniphier: add UniPhier FIFO-less I2C driver") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
1 parent 5736184 commit 38f5d8d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/i2c/busses/i2c-uniphier.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap,
248248
return ret;
249249

250250
for (msg = msgs; msg < emsg; msg++) {
251-
/* If next message is read, skip the stop condition */
252-
bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD);
253-
/* but, force it if I2C_M_STOP is set */
254-
if (msg->flags & I2C_M_STOP)
255-
stop = true;
251+
/* Emit STOP if it is the last message or I2C_M_STOP is set. */
252+
bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP);
256253

257254
ret = uniphier_i2c_master_xfer_one(adap, msg, stop);
258255
if (ret)

0 commit comments

Comments
 (0)