summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2021-06-10 11:02:47 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-15 14:03:27 +0200
commit3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb (patch)
tree0af2a1a3482bf777f758835eee06a2bb2ea0d7ac /drivers/tty/serial/sh-sci.c
parentd8f0209bfedb801d06a81a74b003a882dee3ea3f (diff)
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 <arnd@arndb.de> Cc: David Lin <dtwlin@gmail.com> Cc: Johan Hovold <johan@kernel.org> Cc: Alex Elder <elder@kernel.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Andy Gross <agross@kernel.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Oliver Neukum <oneukum@suse.com> Acked-by: Alex Elder <elder@kernel.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz> Link: https://lore.kernel.org/r/20210610090247.2593-4-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index aabe66c99c1a..07eb56294371 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2500,25 +2500,7 @@ done:
uart_update_timeout(port, termios->c_cflag, baud);
/* byte size and parity */
- switch (termios->c_cflag & CSIZE) {
- case CS5:
- bits = 7;
- break;
- case CS6:
- bits = 8;
- break;
- case CS7:
- bits = 9;
- break;
- default:
- bits = 10;
- break;
- }
-
- if (termios->c_cflag & CSTOPB)
- bits++;
- if (termios->c_cflag & PARENB)
- bits++;
+ bits = tty_get_frame_size(termios->c_cflag);
if (sci_getreg(port, SEMR)->size)
serial_port_out(port, SEMR, 0);