diff options
author | Jiri Slaby <jslaby@suse.cz> | 2022-02-24 10:55:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-28 21:49:06 +0100 |
commit | 988c5bbea59ffacb7762983760ae40d721ea304b (patch) | |
tree | a45740280669bf483b3c0237d263df936b3b6616 /drivers/tty/serial/8250/8250_port.c | |
parent | 797bd4d41c8b41afc10fad39146ac9558cb39e94 (diff) | |
download | lwn-988c5bbea59ffacb7762983760ae40d721ea304b.tar.gz lwn-988c5bbea59ffacb7762983760ae40d721ea304b.zip |
tty: serial: make use of UART_LCR_WLEN() + tty_get_char_size()
Having a generic UART_LCR_WLEN() macro and the tty_get_char_size()
helper, we can remove all those repeated switch-cases in drivers.
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-tegra@vger.kernel.org
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220224095558.30929-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/8250/8250_port.c')
-rw-r--r-- | drivers/tty/serial/8250/8250_port.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index d30a6c1c4c20..25b84d30e771 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2605,21 +2605,7 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up, { unsigned char cval; - switch (c_cflag & CSIZE) { - case CS5: - cval = UART_LCR_WLEN5; - break; - case CS6: - cval = UART_LCR_WLEN6; - break; - case CS7: - cval = UART_LCR_WLEN7; - break; - default: - case CS8: - cval = UART_LCR_WLEN8; - break; - } + cval = UART_LCR_WLEN(tty_get_char_size(c_cflag)); if (c_cflag & CSTOPB) cval |= UART_LCR_STOP; |