diff options
author | Jiri Slaby (SUSE) <jirislaby@kernel.org> | 2025-06-11 12:03:08 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-17 13:42:35 +0200 |
commit | b3be870161d6b1b621770aebf7b412b6aab00d6f (patch) | |
tree | a9ffadf897193bf260358c3487204ac537c010cf | |
parent | 555ce50f8f75e7861de293ce9a78106311ddaed3 (diff) |
serial: 8250: extract serial8250_set_ier()
serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of IER.
Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20250611100319.186924-23-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/8250/8250_port.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 6bb7f004d607..2c045a4369fc 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2752,6 +2752,22 @@ static void serial8250_set_errors_and_ignores(struct uart_port *port, struct kte port->ignore_status_mask |= UART_LSR_DR; } +static void serial8250_set_ier(struct uart_port *port, struct ktermios *termios) +{ + struct uart_8250_port *up = up_to_u8250p(port); + + /* CTS flow control flag and modem status interrupts */ + up->ier &= ~UART_IER_MSI; + if (!(up->bugs & UART_BUG_NOMSR) && UART_ENABLE_MS(&up->port, termios->c_cflag)) + up->ier |= UART_IER_MSI; + if (up->capabilities & UART_CAP_UUE) + up->ier |= UART_IER_UUE; + if (up->capabilities & UART_CAP_RTOIE) + up->ier |= UART_IER_RTOIE; + + serial_port_out(port, UART_IER, up->ier); +} + void serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, const struct ktermios *old) @@ -2780,20 +2796,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, serial8250_set_afe(port, termios); uart_update_timeout(port, termios->c_cflag, baud); serial8250_set_errors_and_ignores(port, termios); - - /* - * CTS flow control flag and modem status interrupts - */ - up->ier &= ~UART_IER_MSI; - if (!(up->bugs & UART_BUG_NOMSR) && - UART_ENABLE_MS(&up->port, termios->c_cflag)) - up->ier |= UART_IER_MSI; - if (up->capabilities & UART_CAP_UUE) - up->ier |= UART_IER_UUE; - if (up->capabilities & UART_CAP_RTOIE) - up->ier |= UART_IER_RTOIE; - - serial_port_out(port, UART_IER, up->ier); + serial8250_set_ier(port, termios); if (up->capabilities & UART_CAP_EFR) { unsigned char efr = 0; |