aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2014-07-29 14:02:26 +0100
committerJon Medhurst <tixy@linaro.org>2015-03-16 12:00:36 +0000
commita1c1745e64d37ad3bd1101e3fbb54bfc061d6898 (patch)
tree795a37278757b812e2f33c2ed6b356cf42d75c85
parentbb05b5d1883ef6b16980a5fa7f878f4a2c635bc0 (diff)
downloadlinux-a1c1745e64d37ad3bd1101e3fbb54bfc061d6898.tar.gz
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>
-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);