Skip to content

Commit adaa11b

Browse files
committed
rpmsg: qcom_smd: Implement endpoint "poll"
Add support for polling the status of the write buffer so that user space can use rpmsg character devices in non-blocking mode. Signed-off-by: Bjorn Andersson <[email protected]>
1 parent 84d5813 commit adaa11b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

drivers/rpmsg/qcom_smd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,21 @@ static int qcom_smd_trysend(struct rpmsg_endpoint *ept, void *data, int len)
919919
return __qcom_smd_send(qsept->qsch, data, len, false);
920920
}
921921

922+
static unsigned int qcom_smd_poll(struct rpmsg_endpoint *ept,
923+
struct file *filp, poll_table *wait)
924+
{
925+
struct qcom_smd_endpoint *qsept = to_smd_endpoint(ept);
926+
struct qcom_smd_channel *channel = qsept->qsch;
927+
unsigned int mask = 0;
928+
929+
poll_wait(filp, &channel->fblockread_event, wait);
930+
931+
if (qcom_smd_get_tx_avail(channel) > 20)
932+
mask |= POLLOUT | POLLWRNORM;
933+
934+
return mask;
935+
}
936+
922937
/*
923938
* Finds the device_node for the smd child interested in this channel.
924939
*/
@@ -951,6 +966,7 @@ static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = {
951966
.destroy_ept = qcom_smd_destroy_ept,
952967
.send = qcom_smd_send,
953968
.trysend = qcom_smd_trysend,
969+
.poll = qcom_smd_poll,
954970
};
955971

956972
/*

0 commit comments

Comments
 (0)