History

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.

Bjorn Andersson committed 9 years ago

Commit adaa11b1 parent 84d58131 file · +16 −0Browse files

Unified · Split

drivers/rpmsg/qcom_smd.c+16−0
@@ -919,6 +919,21 @@ static int qcom_smd_trysend(struct rpmsg_endpoint *ept, void *data, int len) · 918 unmodified lines
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 = { · 26 unmodified lines
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 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t