diff mbox series

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

Message ID 20170921050357.28558-2-kai.heng.feng@canonical.com
State New
Headers show
Series [1/1,SRU,Xenial] i2c: designware: Use transfer timeout from ioctl I2C_TIMEOUT | expand

Commit Message

Kai-Heng Feng Sept. 21, 2017, 5:03 a.m. UTC
From: Weifeng Voon <weifeng.voon@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@intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit d0bcd8df9aea2bcdbfcb074d408bdc7136031bc5)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/i2c/busses/i2c-designware-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shrirang Bagul Sept. 21, 2017, 7:30 a.m. UTC | #1
On Thu, 2017-09-21 at 13:03 +0800, Kai-Heng Feng wrote:
> From: Weifeng Voon <weifeng.voon@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@intel.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> (cherry picked from commit d0bcd8df9aea2bcdbfcb074d408bdc7136031bc5)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Shrirang Bagul <shrirang.bagul@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)
>  	i2c_dw_xfer_init(dev);
>  
>  	/* 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 */
>  		i2c_dw_init(dev);
> -- 
> 2.14.1
> 

>
Stefan Bader Sept. 27, 2017, 6:33 p.m. UTC | #2
On 21.09.2017 01:03, Kai-Heng Feng wrote:
> From: Weifeng Voon <weifeng.voon@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@intel.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> (cherry picked from commit d0bcd8df9aea2bcdbfcb074d408bdc7136031bc5)
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Stefan Bader <stefan.bader@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)
>  	i2c_dw_xfer_init(dev);
>  
>  	/* 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 */
>  		i2c_dw_init(dev);
>
Thadeu Lima de Souza Cascardo Oct. 9, 2017, 2:26 p.m. UTC | #3
Applied to xenial master-next branch.

Thanks.
Cascardo.

Applied-to: xenial/master-next
diff mbox series

Patch

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)
 	i2c_dw_xfer_init(dev);
 
 	/* 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 */
 		i2c_dw_init(dev);