summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/jsm/jsm_neo.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2022-02-24 12:55:55 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-28 23:49:06 +0300
commit988c5bbea59ffacb7762983760ae40d721ea304b (patch)
treea45740280669bf483b3c0237d263df936b3b6616 /drivers/tty/serial/jsm/jsm_neo.c
parent797bd4d41c8b41afc10fad39146ac9558cb39e94 (diff)
downloadlinux-988c5bbea59ffacb7762983760ae40d721ea304b.tar.xz
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/jsm/jsm_neo.c')
-rw-r--r--drivers/tty/serial/jsm/jsm_neo.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
index c6f927a76c3b..c4fd31de04b4 100644
--- a/drivers/tty/serial/jsm/jsm_neo.c
+++ b/drivers/tty/serial/jsm/jsm_neo.c
@@ -1008,21 +1008,7 @@ static void neo_param(struct jsm_channel *ch)
if (ch->ch_c_cflag & CSTOPB)
lcr |= UART_LCR_STOP;
- switch (ch->ch_c_cflag & CSIZE) {
- case CS5:
- lcr |= UART_LCR_WLEN5;
- break;
- case CS6:
- lcr |= UART_LCR_WLEN6;
- break;
- case CS7:
- lcr |= UART_LCR_WLEN7;
- break;
- case CS8:
- default:
- lcr |= UART_LCR_WLEN8;
- break;
- }
+ lcr |= UART_LCR_WLEN(tty_get_char_size(ch->ch_c_cflag));
ier = readb(&ch->ch_neo_uart->ier);
uart_lcr = readb(&ch->ch_neo_uart->lcr);