Skip to content

Commit

Permalink
i2c-cpm: Detect and report NAK right away instead of timing out
Browse files Browse the repository at this point in the history
Make the driver report an ENXIO error immediately upon NAK instead of
waiting for another interrupt and getting a timeout.

When reading from a device that is not present or declines to respond
to, e.g., a non-existent register address, CPM immediately reports a
NAK condition in the TxBD, but the driver kept waiting until a timeout,
which takes 1 second and causes an ugly console error message.

Signed-off-by: Mike Ditto <mditto@consentry.com>
Acked-by: Jochen Friedrich <jochen@scram.de>
[ben-linux@fluff.org: reordered description text]
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Mike Ditto authored and Ben Dooks committed Dec 16, 2008
1 parent 1bda712 commit a804644
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/i2c/busses/i2c-cpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
pmsg = &msgs[tptr];
if (pmsg->flags & I2C_M_RD)
ret = wait_event_interruptible_timeout(cpm->i2c_wait,
(in_be16(&tbdf[tptr].cbd_sc) & BD_SC_NAK) ||
!(in_be16(&rbdf[rptr].cbd_sc) & BD_SC_EMPTY),
1 * HZ);
else
Expand Down

0 comments on commit a804644

Please sign in to comment.