* [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT
@ 2016-06-02 7:57 Weifeng Voon
2016-06-02 8:33 ` Uwe Kleine-König
0 siblings, 1 reply; 4+ messages in thread
From: Weifeng Voon @ 2016-06-02 7:57 UTC (permalink / raw)
To: Wolfram Sang, Jarkko Nikula
Cc: linux-i2c, linux-kernel, Andy Shevchenko, jui.nee.tan, Weifeng Voon
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT
2016-06-02 7:57 [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT Weifeng Voon
@ 2016-06-02 8:33 ` Uwe Kleine-König
2016-06-02 9:11 ` Voon, Weifeng
0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2016-06-02 8:33 UTC (permalink / raw)
To: Weifeng Voon
Cc: Wolfram Sang, Jarkko Nikula, linux-i2c, linux-kernel,
Andy Shevchenko, jui.nee.tan
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/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT
2016-06-02 8:33 ` Uwe Kleine-König
@ 2016-06-02 9:11 ` Voon, Weifeng
2016-06-09 20:50 ` Wolfram Sang
0 siblings, 1 reply; 4+ messages in thread
From: Voon, Weifeng @ 2016-06-02 9:11 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Wolfram Sang, Jarkko Nikula, linux-i2c, linux-kernel,
Andy Shevchenko, Tan, Jui Nee
> 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/ |
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT
2016-06-02 9:11 ` Voon, Weifeng
@ 2016-06-09 20:50 ` Wolfram Sang
0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-06-09 20:50 UTC (permalink / raw)
To: Voon, Weifeng
Cc: Uwe Kleine-König, Jarkko Nikula, linux-i2c, linux-kernel,
Andy Shevchenko, Tan, Jui Nee
[-- Attachment #1: Type: text/plain, Size: 104 bytes --]
> Set transfer timeout via ioctl I2C_TIMEOUT
"Use transfer timeout from ioctl I2C_TIMEOUT"
?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-09 20:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 7:57 [PATCH] i2c: designware: Enable ioctl I2C_TIMEOUT Weifeng Voon
2016-06-02 8:33 ` Uwe Kleine-König
2016-06-02 9:11 ` Voon, Weifeng
2016-06-09 20:50 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).