summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2014-07-29 14:02:26 +0100
committerJon Medhurst <tixy@linaro.org>2014-09-29 08:48:02 +0100
commitfa7a31edd178deed3a8c2db6633b80b51b90db80 (patch)
tree2422849af1084b133cc4105c3a4ba3faf7c5a335
parent4bc180f873d0cb3f96fd61fcf43420895a1c222f (diff)
mailbox: Remove all message timeouts and block until they complete
Neither the mailbox framework nor the scpi_protocol code correctly handle timeouts if a message is subsequently completed by the SCP, in that case they end up accessing no-longer live stack based objects. Even if the code was reworked to fix those issues, we are still left with problems with the scpi protocol because a delayed message response may look like a reply to a later message. To hopefully avoid all these problems this patch removes all timeouts and forces things block until each message completes. Signed-off-by: Jon Medhurst <tixy@linaro.org> On branch test Untracked files: 000000_scpi_protocol.c nothing added to commit but untracked files present (use "git add" to track) Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--drivers/mailbox/arm_mhu.c3
-rw-r--r--drivers/mailbox/scpi_protocol.c10
2 files changed, 4 insertions, 9 deletions
diff --git a/drivers/mailbox/arm_mhu.c b/drivers/mailbox/arm_mhu.c
index 5029af71780d..c6842784e410 100644
--- a/drivers/mailbox/arm_mhu.c
+++ b/drivers/mailbox/arm_mhu.c
@@ -246,8 +246,7 @@ static int mhu_probe(struct platform_device *pdev)
ctlr->mbox_con.chans = l;
ctlr->mbox_con.num_chans = CHANNEL_MAX;
- ctlr->mbox_con.txdone_poll = true;
- ctlr->mbox_con.txpoll_period = 10;
+ ctlr->mbox_con.txdone_irq = true;
ctlr->mbox_con.ops = &mhu_ops;
ctlr->mbox_con.dev = dev;
diff --git a/drivers/mailbox/scpi_protocol.c b/drivers/mailbox/scpi_protocol.c
index 195f86c6fd58..edcf47ea06ab 100644
--- a/drivers/mailbox/scpi_protocol.c
+++ b/drivers/mailbox/scpi_protocol.c
@@ -168,8 +168,7 @@ static int send_scpi_cmd(struct scpi_data_buf *scpi_buf, bool high_priority)
cl.dev = the_scpi_device;
cl.rx_callback = scpi_rx_callback;
cl.tx_done = NULL;
- cl.tx_block = true;
- cl.tx_tout = 50; /* 50 msec */
+ cl.tx_block = false;
cl.knows_txdone = false;
cl.chan_name = high_priority ?
CHANNEL_HIGH_PRIORITY :
@@ -185,11 +184,8 @@ static int send_scpi_cmd(struct scpi_data_buf *scpi_buf, bool high_priority)
goto free_channel;
}
- if (!wait_for_completion_timeout(&scpi_buf->complete,
- msecs_to_jiffies(50)))
- status = SCPI_ERR_TIMEOUT;
- else
- status = *(u32 *)(data->rx_buf); /* read first word */
+ wait_for_completion(&scpi_buf->complete);
+ status = *(u32 *)(data->rx_buf); /* read first word */
free_channel:
mbox_free_channel(chan);