Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556988
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 2/4] rpmsg: qcom_smd: Implement endpoint "poll" |
| Date | 2017-01-11 23:40 +0100 |
| Message-ID | <sYzIK-4eb-15@gated-at.bofh.it> (permalink) |
| References | <sYzIK-4eb-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 <bjorn.andersson@linaro.org>
---
Changes since v2:
- None
Changes since v1:
- New patch
drivers/rpmsg/qcom_smd.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c
index 3dd73edaa525..9e2af6a18aa2 100644
--- a/drivers/rpmsg/qcom_smd.c
+++ b/drivers/rpmsg/qcom_smd.c
@@ -919,6 +919,21 @@ static int qcom_smd_trysend(struct rpmsg_endpoint *ept, void *data, int len)
return __qcom_smd_send(qsept->qsch, data, len, false);
}
+static unsigned int qcom_smd_poll(struct rpmsg_endpoint *ept,
+ struct file *filp, poll_table *wait)
+{
+ struct qcom_smd_endpoint *qsept = to_smd_endpoint(ept);
+ struct qcom_smd_channel *channel = qsept->qsch;
+ unsigned int mask = 0;
+
+ poll_wait(filp, &channel->fblockread_event, wait);
+
+ if (qcom_smd_get_tx_avail(channel) > 20)
+ mask |= POLLOUT | POLLWRNORM;
+
+ return mask;
+}
+
/*
* Finds the device_node for the smd child interested in this channel.
*/
@@ -951,6 +966,7 @@ static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = {
.destroy_ept = qcom_smd_destroy_ept,
.send = qcom_smd_send,
.trysend = qcom_smd_trysend,
+ .poll = qcom_smd_poll,
};
/*
--
2.11.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v3 2/4] rpmsg: qcom_smd: Implement endpoint "poll" Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-01-11 23:40 +0100
csiph-web