summaryrefslogtreecommitdiff
path: root/drivers/firmware/arm_scpi.c
diff options
context:
space:
mode:
authorAlexey Klimov <alexey.klimov@arm.com>2017-03-29 19:16:27 +0100
committerSudeep Holla <sudeep.holla@arm.com>2017-03-31 11:00:23 +0100
commitc511fa3f35e30982445fae2946f4aade3f42203d (patch)
tree82c71d810d12f1d2e8998aa4fe34df2fc839c766 /drivers/firmware/arm_scpi.c
parentc1ae3cfa0e89fa1a7ecc4c99031f5e9ae99d9201 (diff)
firmware: arm_scpi: reinit completion instead of full init_completion()
Instead of performing full initialization of the completion structure on each transfer in scpi_send_message(), we initialize it at boot time (more specifically, in the relevant probe() function) and use reinit_completion() to reset ->done counter on each message transfer. Signed-off-by: Alexey Klimov <alexey.klimov@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Diffstat (limited to 'drivers/firmware/arm_scpi.c')
-rw-r--r--drivers/firmware/arm_scpi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c
index 9ad0b1934be9..f6cfc31d34c7 100644
--- a/drivers/firmware/arm_scpi.c
+++ b/drivers/firmware/arm_scpi.c
@@ -538,7 +538,7 @@ static int scpi_send_message(u8 idx, void *tx_buf, unsigned int tx_len,
msg->tx_len = tx_len;
msg->rx_buf = rx_buf;
msg->rx_len = rx_len;
- init_completion(&msg->done);
+ reinit_completion(&msg->done);
ret = mbox_send_message(scpi_chan->chan, msg);
if (ret < 0 || !rx_buf)
@@ -872,8 +872,11 @@ static int scpi_alloc_xfer_list(struct device *dev, struct scpi_chan *ch)
return -ENOMEM;
ch->xfers = xfers;
- for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++)
+ for (i = 0; i < MAX_SCPI_XFERS; i++, xfers++) {
+ init_completion(&xfers->done);
list_add_tail(&xfers->node, &ch->xfers_list);
+ }
+
return 0;
}