linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] UART_LCR_WLEN cleanups
@ 2022-02-24  9:55 Jiri Slaby
  2022-02-24  9:55 ` [PATCH 1/5] tty: serial: define UART_LCR_WLEN() macro Jiri Slaby
  0 siblings, 1 reply; 12+ messages in thread
From: Jiri Slaby @ 2022-02-24  9:55 UTC (permalink / raw)
  To: gregkh; +Cc: linux-serial, linux-kernel, Jiri Slaby

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(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-02-28 16:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24  9:55 [PATCH 0/5] UART_LCR_WLEN cleanups Jiri Slaby
2022-02-24  9:55 ` [PATCH 1/5] tty: serial: define UART_LCR_WLEN() macro Jiri Slaby
2022-02-24  9:55   ` [PATCH 2/5] tty: serial: make use of UART_LCR_WLEN() + tty_get_char_size() Jiri Slaby
2022-02-24 16:38     ` Thierry Reding
2022-02-24  9:55   ` [PATCH 3/5] USB: " Jiri Slaby
2022-02-24  9:55   ` [PATCH 4/5] sdio_uart: " Jiri Slaby
2022-02-28 16:16     ` Ulf Hansson
2022-02-24  9:55   ` [PATCH 5/5] mxser: " Jiri Slaby
2022-02-24 10:10   ` [PATCH 1/5] tty: serial: define UART_LCR_WLEN() macro Greg KH
2022-02-24 10:42     ` Jiri Slaby
2022-02-24 11:23       ` Greg KH
2022-02-25  9:40         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).