From: Greg Kroah-Hartman Date: Mon, 2 May 2022 12:56:14 +0000 (+0200) Subject: Merge 5.18-rc5 into tty-next X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9e6a90790357e8b468445f5c549c498126cedefb;p=linux.git Merge 5.18-rc5 into tty-next We need the tty/serial fixes in here as well. Signed-off-by: Greg Kroah-Hartman --- 9e6a90790357e8b468445f5c549c498126cedefb diff --cc drivers/tty/serial/8250/8250_port.c index b8d05a7dfcf9d,1fbd5bf264bec..9b1d47ef15c05 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@@ -3356,38 -3329,9 +3356,38 @@@ static void serial8250_console_restore( serial8250_set_divisor(port, baud, quot, frac); serial_port_out(port, UART_LCR, up->lcr); - serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS); + serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); } +/* + * Print a string to the serial port using the device FIFO + * + * It sends fifosize bytes and then waits for the fifo + * to get empty. + */ +static void serial8250_console_fifo_write(struct uart_8250_port *up, + const char *s, unsigned int count) +{ + int i; + const char *end = s + count; + unsigned int fifosize = up->tx_loadsz; + bool cr_sent = false; + + while (s != end) { + wait_for_lsr(up, UART_LSR_THRE); + + for (i = 0; i < fifosize && s != end; ++i) { + if (*s == '\n' && !cr_sent) { + serial_out(up, UART_TX, '\r'); + cr_sent = true; + } else { + serial_out(up, UART_TX, *s++); + cr_sent = false; + } + } + } +} + /* * Print a string to the serial port trying not to disturb * any possible real use of the port...