Received: from eggs.gnu.org ([2001:4830:134:3::10]:59732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwuj-0000vG-7t for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:35:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHwuh-0003Er-CT for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:35:08 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:32862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHwuh-0003EY-6S for qemu-devel@nongnu.org; Tue, 28 Jun 2016 13:35:07 -0400 Received: by mail-wm0-x242.google.com with SMTP id r201so7672592wme.0 for ; Tue, 28 Jun 2016 10:35:07 -0700 (PDT) Received: from donizetti.lan (94-39-188-118.adsl-ull.clienti.tiscali.it. [94.39.188.118]) by smtp.gmail.com with ESMTPSA id c142sm5305wme.18.2016.06.28.10.35.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 10:35:05 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 28 Jun 2016 19:33:56 +0200 Message-Id: <1467135242-874-27-git-send-email-pbonzini@redhat.com> In-Reply-To: <1467135242-874-1-git-send-email-pbonzini@redhat.com> References: <1467135242-874-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 26/32] serial: simplify tsr_retry reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Move common code outside the if, and reset tsr_retry even in loopback mode. Right now it cannot become non-zero, but it will be possible as soon as we start respecting the baud rate. Tested-by: Bret Ketchum Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- hw/char/serial.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index e65e9e0..904b218 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -258,10 +258,8 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque) s->tsr_retry++; return FALSE; } - s->tsr_retry = 0; - } else { - s->tsr_retry = 0; } + s->tsr_retry = 0; /* Transmit another byte if it is already available. It is only possible when FIFO is enabled and not empty. */ -- 2.7.4