lkml.org 
[lkml]   [2020]   [Jul]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 16/22] samples/rpmsg: Wait for address to be bound to rpdev for sending message
Date
rpmsg_client_sample can use either virtio_rpmsg_bus or vhost_rpmsg_bus
to send messages. In the case of vhost_rpmsg_bus, the destination
address of rpdev will be assigned only after receiving address service
notification from the remote virtio_rpmsg_bus. Wait for address to be
bound to rpdev (rpmsg_client_sample running in vhost system) before
sending messages to the remote virtio_rpmsg_bus.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
samples/rpmsg/rpmsg_client_sample.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/samples/rpmsg/rpmsg_client_sample.c b/samples/rpmsg/rpmsg_client_sample.c
index 514a51945d69..07149d7fbd0c 100644
--- a/samples/rpmsg/rpmsg_client_sample.c
+++ b/samples/rpmsg/rpmsg_client_sample.c
@@ -57,10 +57,14 @@ static void rpmsg_sample_send_msg_work(struct work_struct *work)
struct rpmsg_device *rpdev = idata->rpdev;
int ret;

- /* send a message to our remote processor */
- ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
- if (ret)
- dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
+ if (rpdev->dst != RPMSG_ADDR_ANY) {
+ /* send a message to our remote processor */
+ ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG));
+ if (ret)
+ dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret);
+ } else {
+ schedule_delayed_work(&idata->send_msg_work, msecs_to_jiffies(50));
+ }
}

static int rpmsg_sample_probe(struct rpmsg_device *rpdev)
--
2.17.1
\
 
 \ /
  Last update: 2020-07-02 10:25    [W:0.271 / U:0.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site