* [PATCH v2 -next] i2c: imx: fix handling of wait_for_completion_timeout result
@ 2014-12-27 13:33 Nicholas Mc Guire
2015-01-13 15:16 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Nicholas Mc Guire @ 2014-12-27 13:33 UTC (permalink / raw)
To: Wolfram Sang
Cc: Grant Likely, Rob Herring, Yao Yuan, Fugang Duan, Fabio Estevam,
Jingoo Han, Kaushal Butala, Sedat Dilek, linux-i2c, linux-kernel,
devicetree, Nicholas Mc Guire
wait_for_completion_timeout does not return negative values so
"result" handling here should be simplified to cover the actually
possible cases only.
patch was only compile tested for imx_v6_v7_defconfig
V2 spellchecked this time and proper labeling as
suggested by Sedat Dilek <sedat.dilek@gmail.com>
patch is against linux-next 3.19.0-rc1 -next-20141226
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
drivers/i2c/busses/i2c-imx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 7f3a9fe..2be7d9d 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -628,9 +628,9 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
result = wait_for_completion_timeout(
&i2c_imx->dma->cmd_complete,
msecs_to_jiffies(DMA_TIMEOUT));
- if (result <= 0) {
+ if (result == 0) {
dmaengine_terminate_all(dma->chan_using);
- return result ?: -ETIMEDOUT;
+ return -ETIMEDOUT;
}
/* Waiting for transfer complete. */
@@ -686,9 +686,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
result = wait_for_completion_timeout(
&i2c_imx->dma->cmd_complete,
msecs_to_jiffies(DMA_TIMEOUT));
- if (result <= 0) {
+ if (result == 0) {
dmaengine_terminate_all(dma->chan_using);
- return result ?: -ETIMEDOUT;
+ return -ETIMEDOUT;
}
/* waiting for transfer complete. */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 -next] i2c: imx: fix handling of wait_for_completion_timeout result
2014-12-27 13:33 [PATCH v2 -next] i2c: imx: fix handling of wait_for_completion_timeout result Nicholas Mc Guire
@ 2015-01-13 15:16 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2015-01-13 15:16 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: Grant Likely, Rob Herring, Yao Yuan, Fugang Duan, Fabio Estevam,
Jingoo Han, Kaushal Butala, Sedat Dilek, linux-i2c, linux-kernel,
devicetree
[-- Attachment #1: Type: text/plain, Size: 648 bytes --]
On Sat, Dec 27, 2014 at 08:33:53AM -0500, Nicholas Mc Guire wrote:
> wait_for_completion_timeout does not return negative values so
> "result" handling here should be simplified to cover the actually
> possible cases only.
>
> patch was only compile tested for imx_v6_v7_defconfig
>
> V2 spellchecked this time and proper labeling as
> suggested by Sedat Dilek <sedat.dilek@gmail.com>
>
> patch is against linux-next 3.19.0-rc1 -next-20141226
The last two paragraphs should have been below "---" but other than
that, all is OK.
>
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Applied to for-next, thanks!
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-13 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-27 13:33 [PATCH v2 -next] i2c: imx: fix handling of wait_for_completion_timeout result Nicholas Mc Guire
2015-01-13 15:16 ` 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).