Skip to content

Commit 834119f

Browse files
Jiri Slabygregkh
authored andcommitted
sdio_uart: 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: Ulf Hansson <ulf.hansson@linaro.org> Cc: linux-mmc@vger.kernel.org Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20220224095558.30929-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5e1440b commit 834119f

1 file changed

Lines changed: 2 additions & 15 deletions

File tree

drivers/mmc/core/sdio_uart.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <linux/sched.h>
2929
#include <linux/mutex.h>
3030
#include <linux/seq_file.h>
31+
#include <linux/serial.h>
3132
#include <linux/serial_reg.h>
3233
#include <linux/circ_buf.h>
3334
#include <linux/tty.h>
@@ -250,21 +251,7 @@ static void sdio_uart_change_speed(struct sdio_uart_port *port,
250251
unsigned char cval, fcr = 0;
251252
unsigned int baud, quot;
252253

253-
switch (termios->c_cflag & CSIZE) {
254-
case CS5:
255-
cval = UART_LCR_WLEN5;
256-
break;
257-
case CS6:
258-
cval = UART_LCR_WLEN6;
259-
break;
260-
case CS7:
261-
cval = UART_LCR_WLEN7;
262-
break;
263-
default:
264-
case CS8:
265-
cval = UART_LCR_WLEN8;
266-
break;
267-
}
254+
cval = UART_LCR_WLEN(tty_get_char_size(termios->c_cflag));
268255

269256
if (termios->c_cflag & CSTOPB)
270257
cval |= UART_LCR_STOP;

0 commit comments

Comments
 (0)