diff options
| author | Jiri Slaby <[email protected]> | 2021-06-10 09:02:47 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-06-15 12:03:27 +0000 |
| commit | 3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb (patch) | |
| tree | 0af2a1a3482bf777f758835eee06a2bb2ea0d7ac /drivers/tty/serial/stm32-usart.c | |
| parent | cypress_m8: switch data_bits to real character bits (diff) | |
| download | kernel-3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb.tar.gz kernel-3ec2ff37230e1c961d4b0d0118dd23c46b5bcdbb.zip | |
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 <[email protected]>
Cc: David Lin <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Andy Gross <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Oliver Neukum <[email protected]>
Acked-by: Alex Elder <[email protected]>
Signed-off-by: Jiri Slaby <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/tty/serial/stm32-usart.c')
| -rw-r--r-- | drivers/tty/serial/stm32-usart.c | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index cd6adb979df9..ef793b3b4591 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -718,36 +718,6 @@ static void stm32_usart_shutdown(struct uart_port *port) free_irq(port->irq, port); } -static unsigned int stm32_usart_get_databits(struct ktermios *termios) -{ - unsigned int bits; - - tcflag_t cflag = termios->c_cflag; - - switch (cflag & CSIZE) { - /* - * CSIZE settings are not necessarily supported in hardware. - * CSIZE unsupported configurations are handled here to set word length - * to 8 bits word as default configuration and to print debug message. - */ - case CS5: - bits = 5; - break; - case CS6: - bits = 6; - break; - case CS7: - bits = 7; - break; - /* default including CS8 */ - default: - bits = 8; - break; - } - - return bits; -} - static void stm32_usart_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) @@ -805,7 +775,7 @@ static void stm32_usart_set_termios(struct uart_port *port, if (cflag & CSTOPB) cr2 |= USART_CR2_STOP_2B; - bits = stm32_usart_get_databits(termios); + bits = tty_get_char_size(cflag); stm32_port->rdr_mask = (BIT(bits) - 1); if (cflag & PARENB) { |
