From: tim.blechmann@gmail.com
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-remoteproc@vger.kernel.org, Tim Blechmann <tim@klingt.org>,
Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Subject: [PATCH 1/1] rpmsg: char - treat ENOMEM as EAGAIN
Date: Sun, 13 Mar 2022 10:45:41 +0800 [thread overview]
Message-ID: <20220313024541.1579848-2-tim@klingt.org> (raw)
In-Reply-To: <20220313024541.1579848-1-tim@klingt.org>
From: Tim Blechmann <tim@klingt.org>
rpmsg_trysend() returns -ENOMEM when no rpmsg buffer can be allocated.
this causes write to fail with this error as opposed to -EAGAIN.
this is what user space applications (and libraries like boost.asio)
would expect when using normal character devices.
Signed-off-by: Tim Blechmann <tim@klingt.org>
CC: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
---
drivers/rpmsg/rpmsg_char.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index 5663cf799c95..5b9e708d595a 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -239,14 +239,17 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
if (!eptdev->ept) {
ret = -EPIPE;
goto unlock_eptdev;
}
- if (filp->f_flags & O_NONBLOCK)
+ if (filp->f_flags & O_NONBLOCK) {
ret = rpmsg_trysendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
+ if (ret == -ENOMEM)
+ ret = -EAGAIN;
+ }
else
ret = rpmsg_sendto(eptdev->ept, kbuf, len, eptdev->chinfo.dst);
unlock_eptdev:
mutex_unlock(&eptdev->ept_lock);
--
2.35.1
prev parent reply other threads:[~2022-03-13 2:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 9:30 [PATCH 0/1] rpmsg: char - treat `ENOMEM` as `EAGAIN` Tim Blechmann
2022-02-14 9:30 ` [PATCH 1/1] " Tim Blechmann
2022-03-12 15:14 ` Bjorn Andersson
2022-03-13 2:45 ` [PATCH 0/1 v2] " tim.blechmann
2022-03-13 2:45 ` tim.blechmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220313024541.1579848-2-tim@klingt.org \
--to=tim.blechmann@gmail.com \
--cc=arnaud.pouliquen@foss.st.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=tim@klingt.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.