Skip to content

UART_LCR_WLEN cleanups

Jiri Slaby linux-mmc linux-serial linux-tegra linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5tty: serial: define UART_LCR_WLEN() macroinclude/uapi/linux/serial_reg.h+1 -04 replies
2/5tty: serial: make use of UART_LCR_WLEN() + tty_get_char_size()drivers/tty/serial/8250/8250_omap.c drivers/tty/serial/8250/8250_port.c drivers/tty/serial/jsm/jsm_cls.c +5 more+11 -1221 reply
3/5USB: serial: make use of UART_LCR_WLEN() + tty_get_char_size()drivers/usb/serial/ark3116.c drivers/usb/serial/f81232.c drivers/usb/serial/f81534.c +3 more+7 -940 replies
4/5sdio_uart: make use of UART_LCR_WLEN() + tty_get_char_size()drivers/mmc/core/sdio_uart.c+1 -151 reply
5/5mxser: make use of UART_LCR_WLEN() + tty_get_char_size()drivers/tty/mxser.c+1 -150 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchThierry RedingUlf Hansson
1/5
2/5R-b
3/5
4/5A-b
5/5

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/5] UART_LCR_WLEN cleanups

Many drivers currently do:
switch (cflag & CSIZE) {
case CS5:

           lcr = UART_LCR_WLEN5;
           break;
   case CS6:
           lcr = UART_LCR_WLEN6;
           break;
   case CS7:
           lcr = UART_LCR_WLEN7;
           break;
   default:
   case CS8:
           lcr = UART_LCR_WLEN8;
           break;

}

We can simplify it to:
lcr = UART_LCR_WLEN(tty_get_char_size(cflag));
if we define UART_LCR_WLEN() properly first.

So UART_LCR_WLEN is defined in this series and all such drivers are converted too.

We could go even further: to define something like uart_compute_LCR() and compute there whole LCR based even on parity+stop fields in cflag. I will try if it is worth it later. But this series on its own drops some duplicated lines already.

Jiri Slaby (5):
tty: serial: define UART_LCR_WLEN() macro
tty: serial: make use of UART_LCR_WLEN() + tty_get_char_size()
USB: serial: make use of UART_LCR_WLEN() + tty_get_char_size()
sdio_uart: make use of UART_LCR_WLEN() + tty_get_char_size()
mxser: make use of UART_LCR_WLEN() + tty_get_char_size()

 drivers/mmc/core/sdio_uart.c        | 16 +---------------
 drivers/tty/mxser.c                 | 16 +---------------
 drivers/tty/serial/8250/8250_omap.c | 16 +---------------
 drivers/tty/serial/8250/8250_port.c | 16 +---------------
 drivers/tty/serial/jsm/jsm_cls.c    | 16 +---------------
 drivers/tty/serial/jsm/jsm_neo.c    | 16 +---------------
 drivers/tty/serial/omap-serial.c    | 16 +---------------
 drivers/tty/serial/pxa.c            | 16 +---------------
 drivers/tty/serial/serial-tegra.c   | 22 ++++------------------
 drivers/tty/serial/vr41xx_siu.c     | 15 +--------------
 drivers/usb/serial/ark3116.c        | 17 ++---------------
 drivers/usb/serial/f81232.c         | 16 +---------------
 drivers/usb/serial/f81534.c         | 16 +---------------
 drivers/usb/serial/mos7720.c        | 20 +-------------------
 drivers/usb/serial/quatech2.c       | 16 +---------------
 drivers/usb/serial/ssu100.c         | 16 +---------------
 include/uapi/linux/serial_reg.h     |  1 +
 17 files changed, 21 insertions(+), 246 deletions(-)
Signature · 1 line
2.35.1