Thread (15 messages) 15 messages, 2 authors, 15d ago

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

From: Linus Walleij <linusw@kernel.org>
Date: 2026-06-24 22:52:08
Also in: linux-arm-kernel, linux-i2c, lkml

On Tue, Jun 23, 2026 at 6:32 PM Dmitry Guzman
[off-list ref] 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 <redacted>
This originally came from:

commit ebd10e0783d9fb92a147e60902e22c2d3f3ad69d
Author: Virupax Sadashivpetimath [off-list ref]
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
[off-list ref]
    Reviewed-by: Jonas ABERG [off-list ref]
    Signed-off-by: Linus Walleij [off-list ref]
    Signed-off-by: Ben Dooks [off-list ref]

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@kernel.org>

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help