b28c64
From 4a5819d1786be74df4b2393f72d6901e05d0eb4a Mon Sep 17 00:00:00 2001
b28c64
From: Fam Zheng <famz@redhat.com>
b28c64
Date: Fri, 19 May 2017 00:35:21 +0200
b28c64
Subject: [PATCH 16/18] serial: simplify tsr_retry reset
b28c64
b28c64
RH-Author: Fam Zheng <famz@redhat.com>
b28c64
Message-id: <20170519003523.21163-17-famz@redhat.com>
b28c64
Patchwork-id: 75372
b28c64
O-Subject: [RHEL-7.3.z qemu-kvm PATCH 16/18] serial: simplify tsr_retry reset
b28c64
Bugzilla: 1452332
b28c64
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
b28c64
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
b28c64
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
b28c64
b28c64
From: Paolo Bonzini <pbonzini@redhat.com>
b28c64
b28c64
Move common code outside the if, and reset tsr_retry even in loopback mode.
b28c64
Right now it cannot become non-zero, but it will be possible as soon as
b28c64
we start respecting the baud rate.
b28c64
b28c64
Tested-by: Bret Ketchum <bcketchum@gmail.com>
b28c64
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
b28c64
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
b28c64
(cherry picked from commit bce933b85a34514fe34fa559be1d8ccd1f39f954)
b28c64
Signed-off-by: Fam Zheng <famz@redhat.com>
b28c64
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
b28c64
---
b28c64
 hw/char/serial.c | 4 +---
b28c64
 1 file changed, 1 insertion(+), 3 deletions(-)
b28c64
b28c64
diff --git a/hw/char/serial.c b/hw/char/serial.c
b28c64
index afa1932..fdda802 100644
b28c64
--- a/hw/char/serial.c
b28c64
+++ b/hw/char/serial.c
b28c64
@@ -254,10 +254,8 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
b28c64
                 s->tsr_retry++;
b28c64
                 return FALSE;
b28c64
             }
b28c64
-            s->tsr_retry = 0;
b28c64
-        } else {
b28c64
-            s->tsr_retry = 0;
b28c64
         }
b28c64
+        s->tsr_retry = 0;
b28c64
 
b28c64
         /* Transmit another byte if it is already available. It is only
b28c64
            possible when FIFO is enabled and not empty. */
b28c64
-- 
b28c64
1.8.3.1
b28c64