Skip to content

tty: type unifications -- part I.

Jiri Slaby (SUSE) linux-can linux-serial linux-staging linuxppc-dev lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest36 patches 29 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/36tty: xtensa/iss: drop unneeded tty_operations hooksarch/xtensa/platforms/iss/console.c+0 -241 reply
2/36tty: ldisc: document that ldops are optionalinclude/linux/tty_ldisc.h+25 -50 replies
3/36tty: remove dummy tty_ldisc_ops::poll() implementationsdrivers/bluetooth/hci_ldisc.c drivers/net/ppp/ppp_async.c drivers/net/ppp/ppp_synctty.c +1 more+0 -300 replies
4/36tty: n_null: remove optional ldopsdrivers/tty/n_null.c+0 -180 replies
5/36tty: change tty_write_lock()'s ndelay parameter to booldrivers/tty/tty.h drivers/tty/tty_io.c drivers/tty/tty_ioctl.c+5 -50 replies
6/36tty: tty_port: rename 'disc' to 'ld'drivers/tty/tty_port.c+11 -110 replies
7/36tty: drop tty_debug_wait_until_sent()drivers/tty/tty_ioctl.c+0 -100 replies
8/36tty: make tty_change_softcar() more understandabledrivers/tty/tty_ioctl.c+3 -30 replies
9/36tty: make tty_port_client_operations operate with u8drivers/tty/serdev/serdev-ttyport.c drivers/tty/tty_buffer.c drivers/tty/tty_port.c +1 more+12 -120 replies
10/36tty: make counts in tty_port_client_operations hooks size_tdrivers/tty/serdev/serdev-ttyport.c drivers/tty/tty_port.c include/linux/tty_port.h+10 -110 replies
11/36tty: switch receive_buf() counts to size_tdrivers/tty/tty_buffer.c+4 -40 replies
12/36tty: switch count in tty_ldisc_receive_buf() to size_tdrivers/tty/tty_buffer.c drivers/tty/vt/selection.c include/linux/tty_flip.h+6 -60 replies
13/36tty: can327: unify error paths in can327_ldisc_rx()drivers/net/can/can327.c+8 -141 reply
14/36tty: can327, move overflow test inside can327_ldisc_rx()'s loopdrivers/net/can/can327.c+7 -81 reply
15/36tty: make tty_ldisc_ops::*buf*() hooks operate on size_tdrivers/accessibility/speakup/spk_ttyio.c drivers/bluetooth/hci_ldisc.c drivers/input/serio/serport.c +16 more+38 -352 replies
16/36tty: use u8 for charsdrivers/accessibility/speakup/spk_ttyio.c drivers/input/serio/serport.c drivers/misc/ti-st/st_core.c +18 more+73 -815 replies
17/36tty: use u8 for flagsdrivers/accessibility/speakup/spk_ttyio.c drivers/bluetooth/hci_ldisc.c drivers/input/serio/serport.c +20 more+54 -552 replies
18/36misc: ti-st: make st_recv() conforming to tty_ldisc_ops::receive_buf()drivers/misc/ti-st/st_core.c drivers/misc/ti-st/st_kim.c include/linux/ti_wilink_st.h+7 -80 replies
19/36tty: make char_buf_ptr()/flag_buf_ptr()'s offset unsignedinclude/linux/tty_buffer.h+2 -20 replies
20/36tty: tty_buffer: make all offsets unsignedinclude/linux/tty_buffer.h+5 -50 replies
21/36tty: don't pass write() to do_tty_write()drivers/tty/tty_io.c+4 -70 replies
22/36tty: rename and de-inline do_tty_write()drivers/tty/tty_io.c+3 -30 replies
23/36tty: use min() in iterate_tty_write()drivers/tty/tty_io.c+2 -60 replies
24/36tty: use ssize_t for iterate_tty_read() returned typedrivers/tty/tty_io.c+8 -80 replies
25/36tty: switch size and count types in iterate_tty_read() to size_tdrivers/tty/tty_io.c+2 -20 replies
26/36tty: use min() for size computation in iterate_tty_read()drivers/tty/tty_io.c+1 -20 replies
27/36tty: propagate u8 data to tty_operations::write()arch/alpha/kernel/srmcons.c arch/m68k/emu/nfcon.c arch/um/drivers/line.c +40 more+53 -884 replies
28/36tty: propagate u8 data to tty_operations::put_char()arch/m68k/emu/nfcon.c drivers/isdn/capi/capi.c drivers/s390/char/con3215.c +11 more+18 -182 replies
29/36tty: make tty_operations::write()'s count size_tarch/alpha/kernel/srmcons.c arch/m68k/emu/nfcon.c arch/um/drivers/line.c +40 more+82 -611 reply
30/36tty: audit: unify to u8drivers/tty/tty.h drivers/tty/tty_audit.c+5 -50 replies
31/36tty: ldops: unify to u8drivers/bluetooth/hci_ldisc.c drivers/input/serio/serport.c drivers/net/ppp/ppp_async.c +7 more+35 -410 replies
32/36tty: hvc: convert counts to size_tdrivers/tty/hvc/hvc_console.c drivers/tty/hvc/hvcs.c drivers/tty/hvc/hvsi.c+9 -90 replies
33/36tty: vcc: convert counts to size_tarch/sparc/include/asm/vio.h drivers/tty/vcc.c+7 -70 replies
34/36tty: gdm724x: convert counts to size_tdrivers/staging/gdm724x/gdm_tty.c+5 -69 replies
35/36tty: hso: simplify hso_serial_write()drivers/net/usb/hso.c+5 -110 replies
36/36tty: rfcomm: convert counts to size_tnet/bluetooth/rfcomm/tty.c+2 -20 replies

Reviews trailers per patch

10 of 36 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMark BrownMax FilippovIlpo JärvinenMax StaudtGeert UytterhoevenAlexander Gordeev
SeriesR-b
1/36A-b
2/36
3/36
4/36
5/36
6/36
7/36
8/36
9/36
10/36
11/36
12/36
13/36R-b
14/36R-b
15/36A-b A-b
16/36A-b A-b
17/36A-b A-b
18/36
19/36
20/36
21/36
22/36
23/36
24/36
25/36
26/36
27/36R-b A-b A-b
28/36R-b A-b A-b
29/36R-b A-b
30/36
31/36
32/36
33/36
34/36R-b
35/36
36/36

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 6 reviewers.

Read the v1 thread

Cover letter [PATCH 00/36] tty: type unifications -- part I.

Currently, the tty layer ops and functions use various types for same things:
* characters and flags: unsigned char, char are used on a random basis,
* counts: int, unsigned int, size_t are used, again more-or-less randomly.

This makes it rather hard to remember where each type is required and it also makes the code harder to follow. Also the code has to do min_t() on many places simply because the variables hold the same kind of data, but of different type.

This is the first part of the series to unify the types:
* make characters and flags 'u8'. This is what the hardware expects and what feeds the tty layer with. Since we compile with -funsigned-char, char and unsigned char are the same types on all platforms. So there is no actual change in type.
* make sizes/counts 'size_t'. This is what comes from the VFS layer and some tty functions already operate on this. So instead of using "shorter" (in term of bytes on 64bit) unsigned int, stick to size_t and promote it to most places.

More cleanup and spreading will be done in tty_buffer, n_tty, and likely other places later.

Patches 1-8 are cleanups only. The rest (the real switch) depends on those.

Jiri Slaby (SUSE) (36):
tty: xtensa/iss: drop unneeded tty_operations hooks
tty: ldisc: document that ldops are optional
tty: remove dummy tty_ldisc_ops::poll() implementations
tty: n_null: remove optional ldops
tty: change tty_write_lock()'s ndelay parameter to bool
tty: tty_port: rename 'disc' to 'ld'
tty: drop tty_debug_wait_until_sent()
tty: make tty_change_softcar() more understandable
tty: make tty_port_client_operations operate with u8
tty: make counts in tty_port_client_operations hooks size_t
tty: switch receive_buf() counts to size_t
tty: switch count in tty_ldisc_receive_buf() to size_t
tty: can327: unify error paths in can327_ldisc_rx()
tty: can327, move overflow test inside can327_ldisc_rx()'s loop
tty: make tty_ldisc_ops::*buf*() hooks operate on size_t
tty: use u8 for chars
tty: use u8 for flags
misc: ti-st: make st_recv() conforming to tty_ldisc_ops::receive_buf()
tty: make char_buf_ptr()/flag_buf_ptr()'s offset unsigned
tty: tty_buffer: make all offsets unsigned
tty: don't pass write() to do_tty_write()
tty: rename and de-inline do_tty_write()
tty: use min() in iterate_tty_write()
tty: use ssize_t for iterate_tty_read() returned type
tty: switch size and count types in iterate_tty_read() to size_t
tty: use min() for size computation in iterate_tty_read()
tty: propagate u8 data to tty_operations::write()
tty: propagate u8 data to tty_operations::put_char()
tty: make tty_operations::write()'s count size_t
tty: audit: unify to u8
tty: ldops: unify to u8
tty: hvc: convert counts to size_t
tty: vcc: convert counts to size_t
tty: gdm724x: convert counts to size_t
tty: hso: simplify hso_serial_write()
tty: rfcomm: convert counts to size_t

 arch/alpha/kernel/srmcons.c               |  5 +-
 arch/m68k/emu/nfcon.c                     |  8 +--
 arch/sparc/include/asm/vio.h              |  2 +-
 arch/um/drivers/line.c                    |  2 +-
 arch/um/drivers/line.h                    |  3 +-
 arch/xtensa/platforms/iss/console.c       | 27 +--------
 drivers/accessibility/speakup/spk_ttyio.c |  5 +-
 drivers/bluetooth/hci_ldisc.c             | 15 ++---
 drivers/char/ttyprintk.c                  |  5 +-
 drivers/input/serio/serport.c             |  8 +--
 drivers/ipack/devices/ipoctal.c           |  7 +--
 drivers/isdn/capi/capi.c                  |  8 +--
 drivers/misc/bcm-vk/bcm_vk_tty.c          |  5 +-
 drivers/misc/ti-st/st_core.c              | 11 ++--
 drivers/misc/ti-st/st_kim.c               |  6 +-
 drivers/mmc/core/sdio_uart.c              |  4 +-
 drivers/net/caif/caif_serial.c            |  2 +-
 drivers/net/can/can327.c                  | 39 ++++++-------
 drivers/net/can/slcan/slcan-core.c        |  5 +-
 drivers/net/hamradio/6pack.c              |  4 +-
 drivers/net/hamradio/mkiss.c              |  4 +-
 drivers/net/mctp/mctp-serial.c            |  5 +-
 drivers/net/ppp/ppp_async.c               | 26 +++------
 drivers/net/ppp/ppp_synctty.c             | 26 +++------
 drivers/net/slip/slip.c                   |  4 +-
 drivers/net/usb/hso.c                     | 20 +++----
 drivers/s390/char/con3215.c               |  6 +-
 drivers/s390/char/con3270.c               |  6 +-
 drivers/s390/char/sclp_tty.c              | 10 ++--
 drivers/s390/char/sclp_vt220.c            |  6 +-
 drivers/staging/gdm724x/gdm_tty.c         | 14 ++---
 drivers/staging/greybus/uart.c            |  3 +-
 drivers/tty/amiserial.c                   |  4 +-
 drivers/tty/ehv_bytechan.c                |  4 +-
 drivers/tty/goldfish.c                    |  7 +--
 drivers/tty/hvc/hvc_console.c             |  4 +-
 drivers/tty/hvc/hvcs.c                    | 10 ++--
 drivers/tty/hvc/hvsi.c                    | 14 ++---
 drivers/tty/ipwireless/hardware.c         |  2 +-
 drivers/tty/ipwireless/tty.c              |  4 +-
 drivers/tty/mips_ejtag_fdc.c              |  6 +-
 drivers/tty/moxa.c                        |  8 +--
 drivers/tty/mxser.c                       |  4 +-
 drivers/tty/n_gsm.c                       | 14 ++---
 drivers/tty/n_hdlc.c                      | 12 ++--
 drivers/tty/n_null.c                      | 25 +--------
 drivers/tty/n_tty.c                       | 59 ++++++++++----------
 drivers/tty/nozomi.c                      |  6 +-
 drivers/tty/pty.c                         |  2 +-
 drivers/tty/rpmsg_tty.c                   |  5 +-
 drivers/tty/serdev/serdev-ttyport.c       |  4 +-
 drivers/tty/serial/kgdb_nmi.c             |  3 +-
 drivers/tty/serial/serial_core.c          |  5 +-
 drivers/tty/synclink_gt.c                 | 13 ++---
 drivers/tty/tty.h                         |  8 +--
 drivers/tty/tty_audit.c                   |  6 +-
 drivers/tty/tty_buffer.c                  | 35 ++++++------
 drivers/tty/tty_io.c                      | 46 +++++++---------
 drivers/tty/tty_ioctl.c                   | 18 ++----
 drivers/tty/tty_port.c                    | 34 ++++++------
 drivers/tty/ttynull.c                     |  4 +-
 drivers/tty/vcc.c                         | 18 +++---
 drivers/tty/vt/selection.c                |  2 +-
 drivers/tty/vt/vt.c                       |  6 +-
 drivers/usb/class/cdc-acm.c               |  8 +--
 drivers/usb/gadget/function/u_serial.c    |  6 +-
 drivers/usb/host/xhci-dbgtty.c            |  7 +--
 drivers/usb/serial/usb-serial.c           |  5 +-
 include/linux/ti_wilink_st.h              |  2 +-
 include/linux/tty_buffer.h                | 18 +++---
 include/linux/tty_driver.h                |  9 ++-
 include/linux/tty_flip.h                  | 22 ++++----
 include/linux/tty_ldisc.h                 | 67 +++++++++++++++--------
 include/linux/tty_port.h                  |  7 ++-
 net/bluetooth/rfcomm/tty.c                |  9 +--
 net/nfc/nci/uart.c                        | 15 ++---
 sound/soc/codecs/cx20442.c                |  4 +-
 sound/soc/ti/ams-delta.c                  |  2 +-
 78 files changed, 381 insertions(+), 493 deletions(-)
Signature · 1 line
2.41.0