Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial: 8250: extract serial8250_set_trigger_for_slow_speed()

serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of trigger level for slow speeds.

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-20-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
cc7c9cbe 0fa5aa0b

+19 -7
+19 -7
drivers/tty/serial/8250/8250_port.c
··· 2686 2686 } 2687 2687 } 2688 2688 2689 + static void serial8250_set_trigger_for_slow_speed(struct uart_port *port, struct ktermios *termios, 2690 + unsigned int baud) 2691 + { 2692 + struct uart_8250_port *up = up_to_u8250p(port); 2693 + 2694 + if (!(up->capabilities & UART_CAP_FIFO)) 2695 + return; 2696 + if (port->fifosize <= 1) 2697 + return; 2698 + if (baud >= 2400) 2699 + return; 2700 + if (up->dma) 2701 + return; 2702 + 2703 + up->fcr &= ~UART_FCR_TRIGGER_MASK; 2704 + up->fcr |= UART_FCR_TRIGGER_1; 2705 + } 2706 + 2689 2707 void 2690 2708 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, 2691 2709 const struct ktermios *old) ··· 2728 2710 uart_port_lock_irqsave(port, &flags); 2729 2711 2730 2712 up->lcr = cval; /* Save computed LCR */ 2731 - 2732 - if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { 2733 - if (baud < 2400 && !up->dma) { 2734 - up->fcr &= ~UART_FCR_TRIGGER_MASK; 2735 - up->fcr |= UART_FCR_TRIGGER_1; 2736 - } 2737 - } 2713 + serial8250_set_trigger_for_slow_speed(port, termios, baud); 2738 2714 2739 2715 /* 2740 2716 * MCR-based auto flow control. When AFE is enabled, RTS will be