From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG8Kl-0003Mn-10 for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bG8Ke-0006UV-RI for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:22:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bG8Ke-0006UI-LB for qemu-devel@nongnu.org; Thu, 23 Jun 2016 13:22:24 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DB076266F for ; Thu, 23 Jun 2016 17:22:24 +0000 (UTC) From: Paolo Bonzini Date: Thu, 23 Jun 2016 19:22:15 +0200 Message-Id: <1466702539-17607-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1466702539-17607-1-git-send-email-pbonzini@redhat.com> References: <1466702539-17607-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/6] serial: simplify tsr_retry reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: dgilbert@redhat.com 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 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.5.5