All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mailbox: Complete wait event only if Tx was successful
@ 2014-12-10 20:16 ` Ashwin Chaugule
  0 siblings, 0 replies; 14+ messages in thread
From: Ashwin Chaugule @ 2014-12-10 20:16 UTC (permalink / raw)
  To: linux-arm-kernel

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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-12-16 13:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 20:16 [PATCH] Mailbox: Complete wait event only if Tx was successful Ashwin Chaugule
2014-12-10 20:16 ` Ashwin Chaugule
2014-12-12  8:43 ` [Linaro-acpi] " Sudeep Holla
2014-12-12  8:43   ` Sudeep Holla
2014-12-12 17:47   ` Ashwin Chaugule
2014-12-12 17:47     ` Ashwin Chaugule
2014-12-16 11:36     ` Sudeep Holla
2014-12-16 11:36       ` Sudeep Holla
2014-12-16 13:00       ` Ashwin Chaugule
2014-12-16 13:00         ` Ashwin Chaugule
2014-12-12 10:21 ` Jassi Brar
2014-12-12 10:21   ` Jassi Brar
2014-12-12 17:58   ` Ashwin Chaugule
2014-12-12 17:58     ` Ashwin Chaugule

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.