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_errors_and_ignores

serial8250_do_set_termios() consists of many registers and up flags
settings. Extract all these into separate functions. This time, setting
of ignore_status_mask and read_status_mask.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/20250611100319.186924-22-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Slaby (SUSE) and committed by
Greg Kroah-Hartman
555ce50f 3b3d253b

+33 -34
+33 -34
drivers/tty/serial/8250/8250_port.c
··· 2720 2720 up->mcr |= UART_MCR_AFE; 2721 2721 } 2722 2722 2723 + static void serial8250_set_errors_and_ignores(struct uart_port *port, struct ktermios *termios) 2724 + { 2725 + /* 2726 + * Specify which conditions may be considered for error handling and the ignoring of 2727 + * characters. The actual ignoring of characters only occurs if the bit is set in 2728 + * @ignore_status_mask as well. 2729 + */ 2730 + port->read_status_mask = UART_LSR_OE | UART_LSR_DR; 2731 + if (termios->c_iflag & INPCK) 2732 + port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 2733 + if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) 2734 + port->read_status_mask |= UART_LSR_BI; 2735 + 2736 + /* Characters to ignore */ 2737 + port->ignore_status_mask = 0; 2738 + if (termios->c_iflag & IGNPAR) 2739 + port->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 2740 + if (termios->c_iflag & IGNBRK) { 2741 + port->ignore_status_mask |= UART_LSR_BI; 2742 + /* 2743 + * If we're ignoring parity and break indicators, ignore overruns too (for real raw 2744 + * support). 2745 + */ 2746 + if (termios->c_iflag & IGNPAR) 2747 + port->ignore_status_mask |= UART_LSR_OE; 2748 + } 2749 + 2750 + /* ignore all characters if CREAD is not set */ 2751 + if ((termios->c_cflag & CREAD) == 0) 2752 + port->ignore_status_mask |= UART_LSR_DR; 2753 + } 2754 + 2723 2755 void 2724 2756 serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, 2725 2757 const struct ktermios *old) ··· 2779 2747 serial8250_set_trigger_for_slow_speed(port, termios, baud); 2780 2748 serial8250_set_afe(port, termios); 2781 2749 uart_update_timeout(port, termios->c_cflag, baud); 2782 - 2783 - /* 2784 - * Specify which conditions may be considered for error 2785 - * handling and the ignoring of characters. The actual 2786 - * ignoring of characters only occurs if the bit is set 2787 - * in @ignore_status_mask as well. 2788 - */ 2789 - port->read_status_mask = UART_LSR_OE | UART_LSR_DR; 2790 - if (termios->c_iflag & INPCK) 2791 - port->read_status_mask |= UART_LSR_FE | UART_LSR_PE; 2792 - if (termios->c_iflag & (IGNBRK | BRKINT | PARMRK)) 2793 - port->read_status_mask |= UART_LSR_BI; 2794 - 2795 - /* 2796 - * Characters to ignore 2797 - */ 2798 - port->ignore_status_mask = 0; 2799 - if (termios->c_iflag & IGNPAR) 2800 - port->ignore_status_mask |= UART_LSR_PE | UART_LSR_FE; 2801 - if (termios->c_iflag & IGNBRK) { 2802 - port->ignore_status_mask |= UART_LSR_BI; 2803 - /* 2804 - * If we're ignoring parity and break indicators, 2805 - * ignore overruns too (for real raw support). 2806 - */ 2807 - if (termios->c_iflag & IGNPAR) 2808 - port->ignore_status_mask |= UART_LSR_OE; 2809 - } 2810 - 2811 - /* 2812 - * ignore all characters if CREAD is not set 2813 - */ 2814 - if ((termios->c_cflag & CREAD) == 0) 2815 - port->ignore_status_mask |= UART_LSR_DR; 2750 + serial8250_set_errors_and_ignores(port, termios); 2816 2751 2817 2752 /* 2818 2753 * CTS flow control flag and modem status interrupts