* [PATCH 0/4] generic timeout handling for Renesas drivers
@ 2015-06-20 19:03 Wolfram Sang
2015-06-20 19:03 ` [PATCH 1/4] i2c: rcar: use adapter default for timeout Wolfram Sang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Wolfram Sang @ 2015-06-20 19:03 UTC (permalink / raw)
To: linux-i2c
Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart,
Geert Uytterhoeven, Wolfram Sang
Here is a small patch series to make I2C timeout handling easier for users. It
is not so amazingly huge anymore and it can be modified via i2c-dev if wanted.
While at it, fix the type of the timeout variable to the proper one.
This time build-tested twice!
Wolfram Sang (4):
i2c: rcar: use adapter default for timeout
i2c: rcar: use proper type for timeout
i2c: sh_mobile: use adapter default for timeout
i2c: sh_mobile: use proper type for timeout
drivers/i2c/busses/i2c-rcar.c | 5 +++--
drivers/i2c/busses/i2c-sh_mobile.c | 9 +++++----
2 files changed, 8 insertions(+), 6 deletions(-)
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/4] i2c: rcar: use adapter default for timeout 2015-06-20 19:03 [PATCH 0/4] generic timeout handling for Renesas drivers Wolfram Sang @ 2015-06-20 19:03 ` Wolfram Sang [not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-20 19:03 UTC (permalink / raw) To: linux-i2c Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang From: Wolfram Sang <wsa+renesas@sang-engineering.com> 5 seconds is a very large timeout, and it is hardcoded. Use the default timeout from 'struct adapter' which is 1 second. It can also be modified from userspace for specific workloads via i2c-dev. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/busses/i2c-rcar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 9eef46254369b3..e57e520b4756a9 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -532,7 +532,7 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, timeout = wait_event_timeout(priv->wait, rcar_i2c_flags_has(priv, ID_DONE), - 5 * HZ); + adap->timeout); if (!timeout) { ret = -ETIMEDOUT; break; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>]
* [PATCH 2/4] i2c: rcar: use proper type for timeout [not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> @ 2015-06-20 19:03 ` Wolfram Sang 2015-06-20 19:03 ` [PATCH 3/4] i2c: sh_mobile: use adapter default " Wolfram Sang 2015-06-20 19:03 ` [PATCH 4/4] i2c: sh_mobile: use proper type " Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-20 19:03 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang From: Wolfram Sang <wsa+renesas@sang-engineering.com> wait_event_timeout returns long, not int. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/busses/i2c-rcar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index e57e520b4756a9..d8361dada58455 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -490,7 +490,8 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); struct device *dev = rcar_i2c_priv_to_dev(priv); unsigned long flags; - int i, ret, timeout; + int i, ret; + long timeout; pm_runtime_get_sync(dev); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] i2c: sh_mobile: use adapter default for timeout [not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 2015-06-20 19:03 ` [PATCH 2/4] i2c: rcar: use proper type " Wolfram Sang @ 2015-06-20 19:03 ` Wolfram Sang 2015-06-20 19:03 ` [PATCH 4/4] i2c: sh_mobile: use proper type " Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-20 19:03 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang From: Wolfram Sang <wsa+renesas@sang-engineering.com> 5 seconds is a very large timeout, and it is hardcoded. Use the default timeout from 'struct adapter' which is 1 second. It can also be modified from userspace for specific workloads via i2c-dev. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/busses/i2c-sh_mobile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 7193bcfdd94013..5490bfb58f3e80 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -751,7 +751,7 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, /* The interrupt handler takes care of the rest... */ k = wait_event_timeout(pd->wait, pd->sr & (ICSR_TACK | SW_DONE), - 5 * HZ); + adapter->timeout); if (!k) { dev_err(pd->dev, "Transfer request timed out\n"); if (pd->dma_direction != DMA_NONE) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] i2c: sh_mobile: use proper type for timeout [not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> 2015-06-20 19:03 ` [PATCH 2/4] i2c: rcar: use proper type " Wolfram Sang 2015-06-20 19:03 ` [PATCH 3/4] i2c: sh_mobile: use adapter default " Wolfram Sang @ 2015-06-20 19:03 ` Wolfram Sang 2 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-20 19:03 UTC (permalink / raw) To: linux-i2c-u79uwXL29TY76Z2rM5mHXA Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven, Wolfram Sang From: Wolfram Sang <wsa+renesas@sang-engineering.com> wait_event_timeout returns long, not int. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> --- drivers/i2c/busses/i2c-sh_mobile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 5490bfb58f3e80..47659a925e09cd 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -730,7 +730,8 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, struct sh_mobile_i2c_data *pd = i2c_get_adapdata(adapter); struct i2c_msg *msg; int err = 0; - int i, k; + int i; + long timeout; activate_ch(pd); @@ -749,10 +750,10 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter, i2c_op(pd, OP_START, 0); /* The interrupt handler takes care of the rest... */ - k = wait_event_timeout(pd->wait, + timeout = wait_event_timeout(pd->wait, pd->sr & (ICSR_TACK | SW_DONE), adapter->timeout); - if (!k) { + if (!timeout) { dev_err(pd->dev, "Transfer request timed out\n"); if (pd->dma_direction != DMA_NONE) sh_mobile_i2c_cleanup_dma(pd); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] generic timeout handling for Renesas drivers 2015-06-20 19:03 [PATCH 0/4] generic timeout handling for Renesas drivers Wolfram Sang 2015-06-20 19:03 ` [PATCH 1/4] i2c: rcar: use adapter default for timeout Wolfram Sang [not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> @ 2015-06-21 20:34 ` Laurent Pinchart 2015-06-23 17:51 ` Wolfram Sang 3 siblings, 0 replies; 7+ messages in thread From: Laurent Pinchart @ 2015-06-21 20:34 UTC (permalink / raw) To: Wolfram Sang Cc: linux-i2c, linux-sh, Magnus Damm, Simon Horman, Geert Uytterhoeven Hi Wolfram, Thank you for the patches. On Saturday 20 June 2015 21:03:18 Wolfram Sang wrote: > Here is a small patch series to make I2C timeout handling easier for users. > It is not so amazingly huge anymore and it can be modified via i2c-dev if > wanted. While at it, fix the type of the timeout variable to the proper > one. This time build-tested twice! > > Wolfram Sang (4): > i2c: rcar: use adapter default for timeout > i2c: rcar: use proper type for timeout > i2c: sh_mobile: use adapter default for timeout > i2c: sh_mobile: use proper type for timeout For the whole series, Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > drivers/i2c/busses/i2c-rcar.c | 5 +++-- > drivers/i2c/busses/i2c-sh_mobile.c | 9 +++++---- > 2 files changed, 8 insertions(+), 6 deletions(-) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] generic timeout handling for Renesas drivers 2015-06-20 19:03 [PATCH 0/4] generic timeout handling for Renesas drivers Wolfram Sang ` (2 preceding siblings ...) 2015-06-21 20:34 ` [PATCH 0/4] generic timeout handling for Renesas drivers Laurent Pinchart @ 2015-06-23 17:51 ` Wolfram Sang 3 siblings, 0 replies; 7+ messages in thread From: Wolfram Sang @ 2015-06-23 17:51 UTC (permalink / raw) To: linux-i2c Cc: linux-sh, Magnus Damm, Simon Horman, Laurent Pinchart, Geert Uytterhoeven [-- Attachment #1: Type: text/plain, Size: 585 bytes --] On Sat, Jun 20, 2015 at 09:03:18PM +0200, Wolfram Sang wrote: > Here is a small patch series to make I2C timeout handling easier for users. It > is not so amazingly huge anymore and it can be modified via i2c-dev if wanted. > While at it, fix the type of the timeout variable to the proper one. > This time build-tested twice! > > Wolfram Sang (4): > i2c: rcar: use adapter default for timeout > i2c: rcar: use proper type for timeout > i2c: sh_mobile: use adapter default for timeout > i2c: sh_mobile: use proper type for timeout Applied to for-next, thanks! [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-06-23 17:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-20 19:03 [PATCH 0/4] generic timeout handling for Renesas drivers Wolfram Sang
2015-06-20 19:03 ` [PATCH 1/4] i2c: rcar: use adapter default for timeout Wolfram Sang
[not found] ` <1434827002-25918-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-06-20 19:03 ` [PATCH 2/4] i2c: rcar: use proper type " Wolfram Sang
2015-06-20 19:03 ` [PATCH 3/4] i2c: sh_mobile: use adapter default " Wolfram Sang
2015-06-20 19:03 ` [PATCH 4/4] i2c: sh_mobile: use proper type " Wolfram Sang
2015-06-21 20:34 ` [PATCH 0/4] generic timeout handling for Renesas drivers Laurent Pinchart
2015-06-23 17:51 ` 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).