Skip to content

Commit

Permalink
firmware: arm_scpi: reinit completion instead of full init_completion()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Klimov authored and Sudeep Holla committed Mar 31, 2017
1 parent c1ae3cf commit c511fa3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/firmware/arm_scpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c511fa3

Please sign in to comment.