3 Commits

Author SHA1 Message Date
Johan Hovold
2982283bb0 BACKPORT: 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>
(cherry picked from commit 0bbf0a88fa29de6a043ba40058409c7e550fc8be)
[adelva: dropped changes to driver that was not backported]
Bug: 146062677
Change-Id: Ib9fb6041808e59f57d78fa23088bf37a8a8d4518
Signed-off-by: Alistair Delva <adelva@google.com>
2019-12-11 12:24:08 -08:00
Johan Hovold
4818e17215 UPSTREAM: gnss: serial: fix synchronous write timeout
Passing a timeout of zero to the synchronous serdev_device_write()
helper does currently not imply to wait forever (unlike passing zero to
serdev_device_wait_until_sent()). Instead, if there's insufficient
room in the write buffer, we'd end up with an incomplete write.

Fixes: 37768b054f20 ("gnss: add generic serial driver")
Cc: stable <stable@vger.kernel.org>     # 4.19
Signed-off-by: Johan Hovold <johan@kernel.org>
(cherry picked from commit 56a6c7268312cba9436b84cac01b3e502c5c511d)
Bug: 146062677
Change-Id: I6c7b31b385b962f2afc44f467b72ccaaab151332
Signed-off-by: Alistair Delva <adelva@google.com>
2019-12-11 12:22:54 -08:00
Johan Hovold
34c4103cfe UPSTREAM: gnss: add generic serial driver
Add a generic serial GNSS driver (library) which provides a common
implementation for the gnss interface and power management (runtime and
system suspend). This allows GNSS drivers for specific chip to be
implemented by simply providing a set_power() callback to handle three
states: ACTIVE, STANDBY and OFF.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 37768b054f2074f40de3cacd492baed482f5d9da)
Bug: 146062677
Change-Id: I7713c82eea2ce4a6a7956d74dfc964e6d012293c
Signed-off-by: Alistair Delva <adelva@google.com>
2019-12-11 12:02:26 -08:00