From 654ee49b7e0883e660be6e6e20876fc4cbdaadd1 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 10 Jun 2021 11:02:44 +0200 Subject: tty: make tty_get_{char,frame}_size available Many tty drivers contain code to compute bits count depending on termios cflags. So extract this code from serial core to two separate tty helper functions: * tty_get_char_size -- only size of a character, without flags, * tty_get_frame_size -- complete size of a frame including flags. In the next patch, calls to these new functions replace many copies of this code. Note that we accept only cflag as a parameter. That's because some callers like pch_uart_startup or sunsab_console_setup don't have at hand termios which we could pass around. Cc: Joe Perches Cc: Johan Hovold Reviewed-by: Andy Shevchenko Signed-off-by: Jiri Slaby Link: https://lore.kernel.org/r/20210610090247.2593-1-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman --- include/linux/tty.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/linux/tty.h b/include/linux/tty.h index 4c0c7ca1d9a4..19dc1097e09c 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -495,6 +495,9 @@ static inline speed_t tty_get_baud_rate(struct tty_struct *tty) return tty_termios_baud_rate(&tty->termios); } +unsigned char tty_get_char_size(unsigned int cflag); +unsigned char tty_get_frame_size(unsigned int cflag); + extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); extern int tty_termios_hw_change(const struct ktermios *a, const struct ktermios *b); extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); -- cgit v1.2.3