From: ashwin.chaugule@linaro.org (Ashwin Chaugule)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Mailbox: Complete wait event only if Tx was successful
Date: Wed, 10 Dec 2014 15:16:12 -0500 [thread overview]
Message-ID: <1418242572-20998-1-git-send-email-ashwin.chaugule@linaro.org> (raw)
If a wait_for_completion_timeout() call returns due to a timeout,
the mbox code can still call complete() after returning from the wait.
This can cause subsequent transmissions on a channel to fail, since
the wait_for_completion_timeout() sees the completion variable
is !=0, caused by the erroneous complete() call, and immediately
returns without waiting for the time as expected by the client.
Fix this by calling complete() only if the TX was successful.
Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
---
drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index 17e9e4a..4acaddb 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -101,7 +101,7 @@ static void tx_tick(struct mbox_chan *chan, int r)
if (mssg && chan->cl->tx_done)
chan->cl->tx_done(chan->cl, mssg, r);
- if (chan->cl->tx_block)
+ if ((!r) && chan->cl->tx_block)
complete(&chan->tx_complete);
}
--
1.9.1
next reply other threads:[~2014-12-10 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 20:16 Ashwin Chaugule [this message]
2014-12-12 8:43 ` [Linaro-acpi] [PATCH] Mailbox: Complete wait event only if Tx was successful Sudeep Holla
2014-12-12 17:47 ` Ashwin Chaugule
2014-12-16 11:36 ` Sudeep Holla
2014-12-16 13:00 ` Ashwin Chaugule
2014-12-12 10:21 ` Jassi Brar
2014-12-12 17:58 ` Ashwin Chaugule
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1418242572-20998-1-git-send-email-ashwin.chaugule@linaro.org \
--to=ashwin.chaugule@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).