Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1411969 > unrolled thread

[PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT

Started byWeifeng Voon <weifeng.voon@intel.com>
First post2016-06-02 10:00 +0200
Last post2016-06-09 23:00 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT Weifeng Voon <weifeng.voon@intel.com> - 2016-06-02 10:00 +0200
    Re: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT Uwe Kleine-König   <u.kleine-koenig@pengutronix.de> - 2016-06-02 10:40 +0200
      RE: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT "Voon, Weifeng" <weifeng.voon@intel.com> - 2016-06-02 11:20 +0200
        Re: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT Wolfram Sang <wsa@the-dreams.de> - 2016-06-09 23:00 +0200

#1411969 — [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT

FromWeifeng Voon <weifeng.voon@intel.com>
Date2016-06-02 10:00 +0200
Subject[PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT
Message-ID<rFvHR-35T-37@gated-at.bofh.it>
This allows applications to set the transfer timeout in 10ms increments via
ioctl I2C_TIMEOUT.

Signed-off-by: Weifeng Voon <weifeng.voon@intel.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 99b54be..c6922b8 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -663,7 +663,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);
-- 
1.9.1

[toc] | [next] | [standalone]


#1411998

FromUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date2016-06-02 10:40 +0200
Message-ID<rFwky-3Ay-11@gated-at.bofh.it>
In reply to#1411969
On Thu, Jun 02, 2016 at 03:57:30PM +0800, Weifeng Voon wrote:
> This allows applications to set the transfer timeout in 10ms increments via
> ioctl I2C_TIMEOUT.

10ms is only correct with HZ=100. With higher values of HZ you get a
finer resolution. I'd write:

	Respect the transfer timeout set via the I2C_TIMEOUT ioctl.

and not mention the resolution at all. After all your patch doesn't
"enable" that ioctl, just makes use of the value set by it.

Best regards
Uwe


-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[toc] | [prev] | [next] | [standalone]


#1412019

From"Voon, Weifeng" <weifeng.voon@intel.com>
Date2016-06-02 11:20 +0200
Message-ID<rFwXf-450-5@gated-at.bofh.it>
In reply to#1411998
> From: Uwe Kleine-König [mailto:u.kleine-koenig@pengutronix.de]
> On Thu, Jun 02, 2016 at 03:57:30PM +0800, Weifeng Voon wrote:
> > This allows applications to set the transfer timeout in 10ms
> > increments via ioctl I2C_TIMEOUT.
> 
> 10ms is only correct with HZ=100. With higher values of HZ you get a finer
> resolution. I'd write:
> 
> 	Respect the transfer timeout set via the I2C_TIMEOUT ioctl.
> 

10ms is correct and regardless of HZ. 
From i2c-dev.c:
client->adapter->timeout = msecs_to_jiffies(arg * 10);

The purpose of putting in the resolution of 10ms is just for the ease of others when
they are using this patch. I am ok to take it out if it is not necessary.

> and not mention the resolution at all. After all your patch doesn't "enable" that
> ioctl, just makes use of the value set by it.

Yes, you are right. I am just using the value set by it. Maybe this may sounds more 
relevant:
	Set transfer timeout via ioctl I2C_TIMEOUT 

Or any other recommendation?

> 
> Best regards
> Uwe
> 
> 
> --
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[toc] | [prev] | [next] | [standalone]


#1418641

FromWolfram Sang <wsa@the-dreams.de>
Date2016-06-09 23:00 +0200
Message-ID<rIfdv-360-19@gated-at.bofh.it>
In reply to#1412019

[Multipart message — attachments visible in raw view] — view raw

> 	Set transfer timeout via ioctl I2C_TIMEOUT 

"Use transfer timeout from ioctl I2C_TIMEOUT"

?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web