diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2016-09-01 15:28:08 -0700 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2016-09-08 22:15:25 -0700 |
commit | 4b83c52a21cf5a7421b7c28bebf8ff28ba96ceb9 (patch) | |
tree | 750fbb5bb454ea00c2ea96859e08134cb50457bf /samples/rpmsg | |
parent | e88dae5da46d3989fd6a83dd9f6806777b20d1ae (diff) |
rpmsg: Allow callback to return errors
Some rpmsg backends support holding on to and redelivering messages upon
failed handling of them, so provide a way for the callback to report and
error and allow the backends to handle this.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'samples/rpmsg')
-rw-r--r-- | samples/rpmsg/rpmsg_client_sample.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/samples/rpmsg/rpmsg_client_sample.c b/samples/rpmsg/rpmsg_client_sample.c index 4fcd7ee13fb9..f161dfd3e70a 100644 --- a/samples/rpmsg/rpmsg_client_sample.c +++ b/samples/rpmsg/rpmsg_client_sample.c @@ -28,7 +28,7 @@ struct instance_data { int rx_count; }; -static void rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len, +static int rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len, void *priv, u32 src) { int ret; @@ -43,13 +43,15 @@ static void rpmsg_sample_cb(struct rpmsg_device *rpdev, void *data, int len, /* samples should not live forever */ if (idata->rx_count >= MSG_LIMIT) { dev_info(&rpdev->dev, "goodbye!\n"); - return; + return 0; } /* send a new message now */ ret = rpmsg_send(rpdev->ept, MSG, strlen(MSG)); if (ret) dev_err(&rpdev->dev, "rpmsg_send failed: %d\n", ret); + + return 0; } static int rpmsg_sample_probe(struct rpmsg_device *rpdev) |