Commit c87391b5 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by Greg Kroah-Hartman

serial: dz: Assume previous baudrate is valid

Assume previously used termios has a valid baudrate and use
it directly.
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: default avatarMaciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816115739.10928-4-ilpo.jarvinen@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 292e2e7a
...@@ -592,9 +592,12 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios, ...@@ -592,9 +592,12 @@ static void dz_set_termios(struct uart_port *uport, struct ktermios *termios,
baud = uart_get_baud_rate(uport, termios, old_termios, 50, 9600); baud = uart_get_baud_rate(uport, termios, old_termios, 50, 9600);
bflag = dz_encode_baud_rate(baud); bflag = dz_encode_baud_rate(baud);
if (bflag < 0) { /* Try to keep unchanged. */ if (bflag < 0) {
baud = uart_get_baud_rate(uport, old_termios, NULL, 50, 9600); if (old_termios) {
bflag = dz_encode_baud_rate(baud); /* Keep unchanged. */
baud = tty_termios_baud_rate(old_termios);
bflag = dz_encode_baud_rate(baud);
}
if (bflag < 0) { /* Resort to 9600. */ if (bflag < 0) { /* Resort to 9600. */
baud = 9600; baud = 9600;
bflag = DZ_B9600; bflag = DZ_B9600;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment