Skip to content

Commit 0d72038

Browse files
committed
rpmsg: smd: Use announce_create to process any receive work
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 <[email protected]>
1 parent 7586516 commit 0d72038

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/rpmsg/qcom_smd.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,26 @@ static struct device_node *qcom_smd_match_channel(struct device_node *edge_node,
997997
return NULL;
998998
}
999999

1000+
static int qcom_smd_announce_create(struct rpmsg_device *rpdev)
1001+
{
1002+
struct qcom_smd_endpoint *qept = to_smd_endpoint(rpdev->ept);
1003+
struct qcom_smd_channel *channel = qept->qsch;
1004+
unsigned long flags;
1005+
bool kick_state;
1006+
1007+
spin_lock_irqsave(&channel->recv_lock, flags);
1008+
kick_state = qcom_smd_channel_intr(channel);
1009+
spin_unlock_irqrestore(&channel->recv_lock, flags);
1010+
1011+
if (kick_state)
1012+
schedule_work(&channel->edge->state_work);
1013+
1014+
return 0;
1015+
}
1016+
10001017
static const struct rpmsg_device_ops qcom_smd_device_ops = {
10011018
.create_ept = qcom_smd_create_ept,
1019+
.announce_create = qcom_smd_announce_create,
10021020
};
10031021

10041022
static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = {

0 commit comments

Comments
 (0)