]> Git Repo - linux.git/commitdiff
i2c-cpm: Detect and report NAK right away instead of timing out
authorMike Ditto <[email protected]>
Tue, 16 Dec 2008 20:17:09 +0000 (20:17 +0000)
committerBen Dooks <[email protected]>
Tue, 16 Dec 2008 20:17:09 +0000 (20:17 +0000)
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 <[email protected]>
Acked-by: Jochen Friedrich <[email protected]>
[[email protected]: reordered description text]
Signed-off-by: Ben Dooks <[email protected]>
drivers/i2c/busses/i2c-cpm.c

index 228f75723063968c4e77fbb374e5421e5c87e393..3fcf78e906db185187d10c87466786fb3c3280c2 100644 (file)
@@ -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
This page took 0.055899 seconds and 4 git commands to generate.