Skip to content

serdev: make serdev_device_write() more usable

Johan Hovold linux-serial lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4serdev: use zero to indicate infinite write timeoutdrivers/tty/serdev/core.c+5 -20 replies
2/4serdev: make synchronous write return bytes writtendrivers/gnss/serial.c drivers/gnss/sirf.c drivers/tty/serdev/core.c+12 -42 replies
3/4serdev: make synchronous write helper interruptibledrivers/tty/serdev/core.c include/linux/serdev.h+15 -70 replies
4/4serdev: document the write functions using kernel-docdrivers/tty/serdev/core.c+37 -00 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchRob Herring
SeriesR-b
1/4
2/4
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] serdev: make serdev_device_write() more usable

This series make the synchronous serdev_device_write() helper more usable by

1) allowing drivers to pass a zero timeout to indicate that they want to wait forever;

2) returning the number of bytes actually written (buffered) if the helper is interrupted;

3) make the helper use interruptible wait so that the helper can be used on behalf of user space.

Finally, the two write functions are documented using kernel-doc.

Turns out I was using the wrong timeout for two gnss drivers that expected the helper to wait indefinitely. I've fixed up those separately (by using MAX_SCHEDULE_TIMEOUT for now), but for the helper to be usable when using flow control we really want it to be interruptible.

Besides the two gnss drivers, there's currently only one other in-kernel user of this helper and that driver (rave-sp) uses a non-zero timeout and doesn't check the return value and therefore does not need to be updated.

Note that this series depends on the two above mentioned GNSS fixes (submitted for v4.20-rc3).

Johan

Johan Hovold (4):
serdev: use zero to indicate infinite write timeout
serdev: make synchronous write return bytes written
serdev: make synchronous write helper interruptible
serdev: document the write functions using kernel-doc

 drivers/gnss/serial.c     |  2 +-
 drivers/gnss/sirf.c       |  2 +-
 drivers/tty/serdev/core.c | 70 +++++++++++++++++++++++++++++++++++----
 include/linux/serdev.h    |  2 +-
 4 files changed, 66 insertions(+), 10 deletions(-)
Signature · 1 line
2.19.1