On Wed, 7 Mar 2012 20:41:03 +0800, Daniel Kurtz djkurtz@chromium.org wrote:
On Wed, Mar 7, 2012 at 8:12 PM, Chris Wilson chris@chris-wilson.co.uk wrote:
On Wed, 7 Mar 2012 19:50:47 +0800, Daniel Kurtz djkurtz@chromium.org 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@chromium.org
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