diff options
author | Jon Medhurst <tixy@linaro.org> | 2014-07-29 14:02:26 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-03-04 09:34:21 +0000 |
commit | 3c3b84f8bd1b5f5f80846c02ba4b81eba25fc33a (patch) | |
tree | 43c2a171772c62d2aba0f4ccdc9eb591679f30bb | |
parent | 141a8e462f91415b91650ca1164655b39080e50c (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>
-rw-r--r-- | drivers/mailbox/arm_mhu.c | 3 | ||||
-rw-r--r-- | drivers/mailbox/scpi_protocol.c | 10 |
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); |