Skip to content

Commit

Permalink
rpmsg: smd: Use announce_create to process any receive work
Browse files Browse the repository at this point in the history
It is possible that incoming data arrives before the client driver has
reached a point in the probe method where adequate context for handling
the incoming message has been established.

In the event that the client's callback function returns an error the
message will be left on the FIFO and by invoking the receive handler
after the device has been probed the message will be picked off the FIFO
and the callback invoked again.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
Bjorn Andersson committed Mar 28, 2018
1 parent 7586516 commit 0d72038
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions drivers/rpmsg/qcom_smd.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,26 @@ static struct device_node *qcom_smd_match_channel(struct device_node *edge_node,
return NULL;
}

static int qcom_smd_announce_create(struct rpmsg_device *rpdev)
{
struct qcom_smd_endpoint *qept = to_smd_endpoint(rpdev->ept);
struct qcom_smd_channel *channel = qept->qsch;
unsigned long flags;
bool kick_state;

spin_lock_irqsave(&channel->recv_lock, flags);
kick_state = qcom_smd_channel_intr(channel);
spin_unlock_irqrestore(&channel->recv_lock, flags);

if (kick_state)
schedule_work(&channel->edge->state_work);

return 0;
}

static const struct rpmsg_device_ops qcom_smd_device_ops = {
.create_ept = qcom_smd_create_ept,
.announce_create = qcom_smd_announce_create,
};

static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = {
Expand Down

0 comments on commit 0d72038

Please sign in to comment.