--- zzzz-none-000/linux-4.4.271/drivers/tty/serial/serial_core.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/drivers/tty/serial/serial_core.c 2023-04-19 10:22:29.000000000 +0000 @@ -164,6 +164,8 @@ if (retval == 0) { if (uart_console(uport) && uport->cons->cflag) { tty->termios.c_cflag = uport->cons->cflag; + tty->termios.c_ospeed = uport->cons->baud; + tty->termios.c_ispeed = uport->cons->baud; uport->cons->cflag = 0; } /* @@ -1909,7 +1911,7 @@ { 4800, B4800 }, { 2400, B2400 }, { 1200, B1200 }, - { 0, B38400 } + { 0, BOTHER } }; /** @@ -1948,10 +1950,13 @@ * Construct a cflag setting. */ for (i = 0; baud_rates[i].rate; i++) - if (baud_rates[i].rate <= baud) + if (baud_rates[i].rate == baud) break; termios.c_cflag |= baud_rates[i].cflag; + if (!baud_rates[i].rate) { + termios.c_ospeed = baud; + } if (bits == 7) termios.c_cflag |= CS7; @@ -1981,8 +1986,10 @@ * Allow the setting of the UART parameters with a NULL console * too: */ - if (co) + if (co) { co->cflag = termios.c_cflag; + co->baud = baud; + } return 0; }