From 0bbf0a88fa29de6a043ba40058409c7e550fc8be Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Wed, 14 Nov 2018 16:09:02 +0100 Subject: 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 Reviewed-by: Rob Herring Signed-off-by: Greg Kroah-Hartman --- drivers/gnss/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gnss/serial.c') 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? */ -- cgit v1.2.3