Skip to content

Commit

Permalink
i2c: designware: report short transfers
Browse files Browse the repository at this point in the history
Rather than reporting success for a short transfer due to interrupt
latency, report an error both to the caller, as well as to the kernel
log.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Russell King authored and Wolfram Sang committed Nov 24, 2016
1 parent 9c76358 commit 2bf413d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/i2c/busses/i2c-designware-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
}

/* no error */
if (likely(!dev->cmd_err)) {
if (likely(!dev->cmd_err && !dev->status)) {
ret = num;
goto done;
}
Expand All @@ -768,6 +768,11 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
ret = i2c_dw_handle_tx_abort(dev);
goto done;
}

if (dev->status)
dev_err(dev->dev,
"transfer terminated early - interrupt latency too high?\n");

ret = -EIO;

done:
Expand Down

0 comments on commit 2bf413d

Please sign in to comment.