From: Rob Herring <robh@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>,
Andrey Smirnov <andrew.smirnov@gmail.com>,
"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] serdev: make synchronous write return bytes written
Date: Mon, 19 Nov 2018 09:15:37 -0600 [thread overview]
Message-ID: <CAL_JsqLuF-t_Rf5Hh400=aeiLT_ahTfE0a_czZ6XRG-mD9xmig@mail.gmail.com> (raw)
In-Reply-To: <20181114150904.19653-3-johan@kernel.org>
On Wed, Nov 14, 2018 at 9:10 AM Johan Hovold <johan@kernel.org> wrote:
>
> Make the synchronous serdev_device_write() helper behave analogous to
> the asynchronous serdev_device_write_buf() by returning the number of
> bytes written (or rather buffered) also on timeout.
>
> This will allow drivers to distinguish the case where data was partially
> written from the case where no data was written.
>
> Also update the only two users that checked the return value.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> drivers/gnss/serial.c | 2 +-
> drivers/gnss/sirf.c | 2 +-
> drivers/tty/serdev/core.c | 12 ++++++++++--
> 3 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gnss/serial.c b/drivers/gnss/serial.c
> index 31e891f00175..def64b36d994 100644
> --- a/drivers/gnss/serial.c
> +++ b/drivers/gnss/serial.c
> @@ -65,7 +65,7 @@ static int gnss_serial_write_raw(struct gnss_device *gdev,
>
> /* write is only buffered synchronously */
> ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT);
> - if (ret < 0)
> + if (ret < 0 || ret < count)
The 2nd condition covers the 1st condition. Though I guess this will
all change anyways when you address the FIXME below.
> return ret;
>
> /* FIXME: determine if interrupted? */
next prev parent reply other threads:[~2018-11-19 15:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 15:09 [PATCH 0/4] serdev: make serdev_device_write() more usable Johan Hovold
2018-11-14 15:09 ` [PATCH 1/4] serdev: use zero to indicate infinite write timeout Johan Hovold
2018-11-14 15:09 ` [PATCH 2/4] serdev: make synchronous write return bytes written Johan Hovold
2018-11-19 15:15 ` Rob Herring [this message]
2018-11-20 17:09 ` Johan Hovold
2018-11-14 15:09 ` [PATCH 3/4] serdev: make synchronous write helper interruptible Johan Hovold
2018-11-14 15:09 ` [PATCH 4/4] serdev: document the write functions using kernel-doc Johan Hovold
2018-11-19 15:16 ` [PATCH 0/4] serdev: make serdev_device_write() more usable Rob Herring
2018-11-20 17:11 ` Johan Hovold
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='CAL_JsqLuF-t_Rf5Hh400=aeiLT_ahTfE0a_czZ6XRG-mD9xmig@mail.gmail.com' \
--to=robh@kernel.org \
--cc=andrew.smirnov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).