Skip to content

Commit e7d6f84

Browse files
Jiri Slabygregkh
authored andcommitted
mxser: 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. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220224095558.30929-5-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 834119f commit e7d6f84

1 file changed

Lines changed: 1 addition & 15 deletions

File tree

drivers/tty/mxser.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -588,21 +588,7 @@ static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_term
588588
}
589589

590590
/* byte size and parity */
591-
switch (cflag & CSIZE) {
592-
default:
593-
case CS5:
594-
cval = UART_LCR_WLEN5;
595-
break;
596-
case CS6:
597-
cval = UART_LCR_WLEN6;
598-
break;
599-
case CS7:
600-
cval = UART_LCR_WLEN7;
601-
break;
602-
case CS8:
603-
cval = UART_LCR_WLEN8;
604-
break;
605-
}
591+
cval = UART_LCR_WLEN(tty_get_char_size(tty->termios.c_cflag));
606592

607593
if (cflag & CSTOPB)
608594
cval |= UART_LCR_STOP;

0 commit comments

Comments
 (0)