[PATCH 1/1 SRU Xenial] i2c: designware: Use transfer timeout from ioctl I2C_TIMEOUT

Kai-Heng Feng kai.heng.feng at canonical.com
Thu Sep 21 05:03:57 UTC 2017

From: Weifeng Voon <weifeng.voon at intel.com>

BugLink: https://bugs.launchpad.net/bugs/1718578

This allows applications to set the transfer timeout in 10ms increments via
ioctl I2C_TIMEOUT.

Signed-off-by: Weifeng Voon <weifeng.voon at intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula at linux.intel.com>
Acked-by: Uwe Kleine-K├Ânig <u.kleine-koenig at pengutronix.de>
Signed-off-by: Wolfram Sang <wsa at the-dreams.de>
(cherry picked from commit d0bcd8df9aea2bcdbfcb074d408bdc7136031bc5)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 6974a99034c3..c331340f3bcc 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -664,7 +664,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	/* wait for tx to complete */
-	if (!wait_for_completion_timeout(&dev->cmd_complete, HZ)) {
+	if (!wait_for_completion_timeout(&dev->cmd_complete, adap->timeout)) {
 		dev_err(dev->dev, "controller timed out\n");
 		/* i2c_dw_init implicitly disables the adapter */

More information about the kernel-team mailing list