lkml.org 
[lkml]   [2024]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] i2c: xiic: print error code when xiic_start_xfer fails
On Wed, May 8, 2024 at 8:51 AM Andi Shyti <andi.shyti@kernel.org> wrote:
>
> Hi Marc,
>
> On Mon, May 06, 2024 at 11:45:20AM -0400, marc.ferland@gmail.com wrote:
> > From: Marc Ferland <marc.ferland@sonatest.com>
> >
> > xiic_start_xfer can fail for different reasons:
> >
> > - EBUSY: bus is busy or i2c messages still in tx_msg or rx_msg
> > - ETIMEDOUT: timed-out trying to clear the RX fifo
>
> Wolfram has recently removed all the error printouts caused by
> etimedout.
>
> > - EINVAL: wrong clock settings
> >
> > Printing the error code helps identifying the root cause.
> >
> > Signed-off-by: Marc Ferland <marc.ferland@sonatest.com>
> > ---
> > drivers/i2c/busses/i2c-xiic.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> > index 71391b590ada..73729f0180a1 100644
> > --- a/drivers/i2c/busses/i2c-xiic.c
> > +++ b/drivers/i2c/busses/i2c-xiic.c
> > @@ -1165,7 +1165,7 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
> >
> > err = xiic_start_xfer(i2c, msgs, num);
> > if (err < 0) {
> > - dev_err(adap->dev.parent, "Error xiic_start_xfer\n");
> > + dev_err(adap->dev.parent, "Error xiic_start_xfer: %d\n", err);
>
> I don't see the end user being interested in having the error
> number printed in the dmesg. In fact, I doubt the end user is
> interested in this message at all.
>
> We could print the debug messages (or warnings) where the actual
> failure occurs. For example, in the setclk case, a warning is
> already being printed, and I don't see why we should also print
> an error here.
>
> Does that make sense?
>
Yeah, it makes sense. My goal here is to add a bit more context when
things go wrong.

I've been having these _very_ rare failures with this i2c adapter and
the only trace I am getting is this "Error xiic_start_xfer" message in
the kernel logs. So it seemed like a good idea to just print the error
code along with the message.

I'll resend a v2 with your suggestions.

Regards,

Marc

\
 
 \ /
  Last update: 2024-05-08 15:48    [W:0.082 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site