From 3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 10 Jun 2021 11:02:47 +0200 Subject: tty: make use of tty_get_{char,frame}_size In the previous patch, we introduced tty_get_char_size() and tty_get_frame_size() for computing character and frame sizes, respectively. Here, we make use of them in various tty drivers where applicable. The stats look nice: 12 insertions, 169 deletions. Cc: Arnd Bergmann Cc: David Lin Cc: Johan Hovold Cc: Alex Elder Cc: Shawn Guo Cc: Sascha Hauer Cc: Andy Gross Cc: Bjorn Andersson Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: Oliver Neukum Acked-by: Alex Elder Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20210610090247.2593-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/uart.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'drivers/staging/greybus') diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index ccfaa0f21b9c..73f01ed1e5b7 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -494,21 +494,7 @@ static void gb_tty_set_termios(struct tty_struct *tty, (termios->c_cflag & PARODD ? 1 : 2) + (termios->c_cflag & CMSPAR ? 2 : 0) : 0; - switch (termios->c_cflag & CSIZE) { - case CS5: - newline.data_bits = 5; - break; - case CS6: - newline.data_bits = 6; - break; - case CS7: - newline.data_bits = 7; - break; - case CS8: - default: - newline.data_bits = 8; - break; - } + newline.data_bits = tty_get_char_size(termios->c_cflag); /* FIXME: needs to clear unsupported bits in the termios */ gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0); -- cgit v1.2.3