summaryrefslogtreecommitdiffstats
path: root/drivers/gnss
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-11-14 16:09:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-27 19:44:21 +0100
commit0bbf0a88fa29de6a043ba40058409c7e550fc8be (patch)
treeba3ee078527db443cd492fa12f5c4d6862269e47 /drivers/gnss
parent22d66c85fde3b1ca27ab596357e8e2505af7e388 (diff)
downloadlinux-0bbf0a88fa29de6a043ba40058409c7e550fc8be.tar.gz
linux-0bbf0a88fa29de6a043ba40058409c7e550fc8be.tar.bz2
linux-0bbf0a88fa29de6a043ba40058409c7e550fc8be.zip
serdev: make synchronous write return bytes written
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> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gnss')
-rw-r--r--drivers/gnss/serial.c2
-rw-r--r--drivers/gnss/sirf.c2
2 files changed, 2 insertions, 2 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)
return ret;
/* FIXME: determine if interrupted? */
diff --git a/drivers/gnss/sirf.c b/drivers/gnss/sirf.c
index 71d014edd167..b3a4c0e91947 100644
--- a/drivers/gnss/sirf.c
+++ b/drivers/gnss/sirf.c
@@ -85,7 +85,7 @@ static int sirf_write_raw(struct gnss_device *gdev, const unsigned char *buf,
/* write is only buffered synchronously */
ret = serdev_device_write(serdev, buf, count, MAX_SCHEDULE_TIMEOUT);
- if (ret < 0)
+ if (ret < 0 || ret < count)
return ret;
/* FIXME: determine if interrupted? */