Re: [PATCH 3/7] i2c: nomadik: do not try to retransmit I2C message series on errors

From: Linus Walleij

Date: Wed Jun 24 2026 - 18:52:06 EST


On Tue, Jun 23, 2026 at 6:32 PM Dmitry Guzman
<Dmitry.Guzman@xxxxxxxxxxxx> wrote:

> 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 <Dmitry.Guzman@xxxxxxxxxxxx>

This originally came from:

commit ebd10e0783d9fb92a147e60902e22c2d3f3ad69d
Author: Virupax Sadashivpetimath <virupax.sadashivpetimath@xxxxxxxxxxxxxx>
Date: Fri May 13 12:30:23 2011 +0200

i2c-nomadik: add code to retry on timeout failure

It is seen that i2c-nomadik controller randomly stops generating the
interrupts leading to a i2c timeout. As a workaround to this problem,
add retries to the on going transfer on failure.

Signed-off-by: Virupax Sadashivpetimath
<virupax.sadashivpetimath@xxxxxxxxxxxxxx>
Reviewed-by: Jonas ABERG <jonas.aberg@xxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Ben Dooks <ben-linux@xxxxxxxxx>

At that time the code looked very different:

for (j = 0; j < 3; j++) {
if (status || (dev->result)) {
(...)
break;
}
udelay(I2C_DELAY);
}
if (status == 0)
break;

We would only spin here if both status and dev->result
(the number of sent bytes) was 0. This doesn't seem to be
at all the case anymore!

I suppose it's a bit dubious code, so:
Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

Yours,
Linus Walleij