Re: [PATCH 6/9] drm/i915/intel_i2c: return -ENXIO for device NAK

From: Chris Wilson
Date: Wed Mar 07 2012 - 07:53:29 EST


On Wed, 7 Mar 2012 20:41:03 +0800, Daniel Kurtz <djkurtz@xxxxxxxxxxxx> wrote:
> On Wed, Mar 7, 2012 at 8:12 PM, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote:
> > On Wed,  7 Mar 2012 19:50:47 +0800, Daniel Kurtz <djkurtz@xxxxxxxxxxxx> wrote:
> >> Return -ENXIO if a device NAKs a transaction.
> >>
> >> Note: We should return -ETIMEDOUT, too if the transaction times out,
> >> however, that error path is currently handled by the 'bit-bang fallback'.
> >>
> >> Signed-off-by: Daniel Kurtz <djkurtz@xxxxxxxxxxxx>
> >
> > Can you clarify what the rule is if an error is detected part-way
> > through a xfer?
>
> A priceless comment from drivers/i2c/i2c-core::i2c_transfer...

Thanks, that is about as consistent as one expects with i2c. ;)

> This doesn't specify what to do if the transfer doesn't get an ACK
> during another phase of the transfer.
> However, it does say to send -ENXIO "if no ACK during address phase",
> which is a subset of the possible no-ACK conditions during a transfer.
> Thus, I choose to return ENXIO in all no-ACK cases, to ensure we send
> it during the one case that is specified.

This (and a summary of the rest) deserves to be captured as a comment in
the code.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/