[Devel] [PATCH RHEL9 COMMIT] ms/serial: dz: Assume previous baudrate is valid

Konstantin Khorenko khorenko at virtuozzo.com
Fri Nov 3 21:03:16 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-284.25.1.vz9.30.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-284.25.1.vz9.30.10
------>
commit 58d30bbc65764ab66cd7db55d956e3dcc12feab6
Author: Ilpo Järvinen <ilpo.jarvinen at linux.intel.com>
Date:   Tue Aug 16 14:57:34 2022 +0300

    ms/serial: dz: Assume previous baudrate is valid
    
    Assume previously used termios has a valid baudrate and use
    it directly.
    
    Reviewed-by: Andy Shevchenko <andy.shevchenko at gmail.com>
    Acked-by: Maciej W. Rozycki <macro at orcam.me.uk>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen at linux.intel.com>
    Link: https://lore.kernel.org/r/20220816115739.10928-4-ilpo.jarvinen@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
    
    Getting rid of compilation warnings.
    
    https://virtuozzo.atlassian.net/browse/PSBM-148793
    
    Feature: fix ms/drivers
    
    (cherry picked from commit c87391b5dd77fbd4fd0b0a96fa867a169842b0a9)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 drivers/tty/serial/dz.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/dz.c b/drivers/tty/serial/dz.c
index 725cd9673dfc..829b452daee9 100644
--- a/drivers/tty/serial/dz.c
+++ b/drivers/tty/serial/dz.c
@@ -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);
 	bflag = dz_encode_baud_rate(baud);
-	if (bflag < 0)	{			/* Try to keep unchanged.  */
-		baud = uart_get_baud_rate(uport, old_termios, NULL, 50, 9600);
-		bflag = dz_encode_baud_rate(baud);
+	if (bflag < 0)	{
+		if (old_termios) {
+			/* Keep unchanged. */
+			baud = tty_termios_baud_rate(old_termios);
+			bflag = dz_encode_baud_rate(baud);
+		}
 		if (bflag < 0)	{		/* Resort to 9600.  */
 			baud = 9600;
 			bflag = DZ_B9600;


More information about the Devel mailing list