[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL_JsqLuF-t_Rf5Hh400=aeiLT_ahTfE0a_czZ6XRG-mD9xmig@mail.gmail.com>
Date: Mon, 19 Nov 2018 09:15:37 -0600
From: Rob Herring <robh@...nel.org>
To: Johan Hovold <johan@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Andrey Smirnov <andrew.smirnov@...il.com>,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] serdev: make synchronous write return bytes written
On Wed, Nov 14, 2018 at 9:10 AM Johan Hovold <johan@...nel.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@...nel.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? */
Powered by blists - more mailing lists