diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2013-05-22 06:03:11 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-06-12 14:39:06 -0400 |
commit | e42dba569fceca5d59a88571370785e9ce9775b8 (patch) | |
tree | a3a20a20e227af9ba26d8025de5b53608e24b0f0 /drivers/i2c/busses | |
parent | dfda7d8f09323163cad26dd35fe6293b4f7cee85 (diff) |
i2c: designware: prevent signals from aborting I2C transfers
If a process receives signal while it is waiting for I2C transfer to
complete, an error is returned to the caller and the transfer is aborted.
This can cause the driver to fail subsequent transfers. Also according to
commit d295a86eab2 (i2c: mv64xxx: work around signals causing I2C
transactions to be aborted) I2C drivers aren't supposed to abort
transactions on signals.
To prevent this switch to use wait_for_completion_timeout() instead of
wait_for_completion_interruptible_timeout() in the designware I2C driver.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Christian Ruppert <christian.ruppert@abilis.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index c41ca6354fc5..db20a2841b75 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -580,14 +580,13 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
580 | i2c_dw_xfer_init(dev); | 580 | i2c_dw_xfer_init(dev); |
581 | 581 | ||
582 | /* wait for tx to complete */ | 582 | /* wait for tx to complete */ |
583 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, HZ); | 583 | ret = wait_for_completion_timeout(&dev->cmd_complete, HZ); |
584 | if (ret == 0) { | 584 | if (ret == 0) { |
585 | dev_err(dev->dev, "controller timed out\n"); | 585 | dev_err(dev->dev, "controller timed out\n"); |
586 | i2c_dw_init(dev); | 586 | i2c_dw_init(dev); |
587 | ret = -ETIMEDOUT; | 587 | ret = -ETIMEDOUT; |
588 | goto done; | 588 | goto done; |
589 | } else if (ret < 0) | 589 | } |
590 | goto done; | ||
591 | 590 | ||
592 | if (dev->msg_err) { | 591 | if (dev->msg_err) { |
593 | ret = dev->msg_err; | 592 | ret = dev->msg_err; |