i2c-nomadik driver of I2C bus controller in `xfer` callback retransmits the whole message series in cause of any fault, and returns fault only after third failed attempt. This behavior contradicts with API because not only it hides hardware faults, but also re-sends messages, while they are not guaranteed to be idempotent.
Remove the triple attempt to send messages in `xfer` callback. Signed-off-by: Dmitry Guzman <[email protected]> --- drivers/i2c/busses/i2c-nomadik.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index e4e5c6943c66144058fba857d7bf6c0be79ed5bd..3eb06988c026e5c573fcf55d83de7136b5ca7ac9 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -716,27 +716,21 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, int status = 0; int i; struct nmk_i2c_dev *priv = i2c_get_adapdata(i2c_adap); - int j; pm_runtime_get_sync(&priv->adev->dev); - /* Attempt three times to send the message queue */ - for (j = 0; j < 3; j++) { - /* setup the i2c controller */ - setup_i2c_controller(priv); - - for (i = 0; i < num_msgs; i++) { - priv->cli.slave_adr = msgs[i].addr; - priv->cli.buffer = msgs[i].buf; - priv->cli.count = msgs[i].len; - priv->stop = (i < (num_msgs - 1)) ? 0 : 1; - priv->result = 0; - - status = nmk_i2c_xfer_one(priv, msgs[i].flags); - if (status != 0) - break; - } - if (status == 0) + /* setup the i2c controller */ + setup_i2c_controller(priv); + + for (i = 0; i < num_msgs; i++) { + priv->cli.slave_adr = msgs[i].addr; + priv->cli.buffer = msgs[i].buf; + priv->cli.count = msgs[i].len; + priv->stop = (i < (num_msgs - 1)) ? 0 : 1; + priv->result = 0; + + status = nmk_i2c_xfer_one(priv, msgs[i].flags); + if (status != 0) break; } -- 2.43.0
