From patchwork Mon Jun 20 14:29:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9187777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 362B6601C0 for ; Mon, 20 Jun 2016 15:14:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24CAE265B9 for ; Mon, 20 Jun 2016 15:14:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19013271FD; Mon, 20 Jun 2016 15:14:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E5C3265B9 for ; Mon, 20 Jun 2016 15:14:41 +0000 (UTC) Received: from localhost ([::1]:44259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF0uO-0008N0-5e for patchwork-qemu-devel@patchwork.kernel.org; Mon, 20 Jun 2016 11:14:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF0CS-000852-Bu for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:29:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF0CP-0003Bl-5u for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:29:15 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF0CO-0003Bd-Vv for qemu-devel@nongnu.org; Mon, 20 Jun 2016 10:29:13 -0400 Received: by mail-wm0-x244.google.com with SMTP id a66so9445977wme.2 for ; Mon, 20 Jun 2016 07:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=sPCNAWrcHAu6m2hNeHgnh7Ze0+lFnp/DQuSt/qmH9HI=; b=seB/pQ04a3JLo6DsDD8V8ICJFyupE8/ueCujUJ6lDZWk+ZzMgvp8iCjgY9njKr1y0l MIn7xhwgv1JtX2ZxYnNezsxwSnWlndRyjxx/u2gvUr7uYacy0w23LVEkX2IyhGo9Z/wz /YqiGL+l66q7iJwbWGo0Y7pgVDyS39whqMYPGXjxm1dxPHMapKluAd5vtLv0w3Ft46b+ R/UN0y/c0tLlLp21S5kZrMMC2YyHnUayewnzSy5SHL1/CGzM9k64DesygmewcnCXehs5 IKAWrG2hqHRWyv1g9PHyGmaIcc4IOAjHuXC2ba8l5leWPVkyEJpeS8TE2dEdUfrp/2hz Xh/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=sPCNAWrcHAu6m2hNeHgnh7Ze0+lFnp/DQuSt/qmH9HI=; b=AgRDo5NeFKxzainmS+hA5E4xD+KaqxlrOGWNB/9Vl3fVlTSQpkgAR7rqF+DIvSt5+y xS9jcJPXG0zRetvcOP7IRT9RpUw5nOMrSxh7zGyKQFW7OtTPOO6x1GuKvFKTZWLtvTOs P6u646x7MYCKRdZqEcGkDvJGVdcB9Kh7sJypcouGKsSePDsYaZfhs96SieMXlsMklCPI ZiVLQaWqiXqa+QTVXrogdAjFPPQxQIaGDRhwDoV8Sloq5P0S8zisbS5XnN+c4UwnK8wI F8UckAG2DzHtCGVEXD2M0NsMc+Y3TGoxC0tU8zvoVzIArCGfQm/BiVyrL7HpKV8Gnt5K 3wkA== X-Gm-Message-State: ALyK8tKPo6PnaS1SaHdKULQPCgxG3eXEzNn06bUjPAsIGZxDxWNySGRFD8CQ8WGbx0rbqw== X-Received: by 10.194.79.228 with SMTP id m4mr1209330wjx.171.1466432952377; Mon, 20 Jun 2016 07:29:12 -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 bb4sm24359892wjb.32.2016.06.20.07.29.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jun 2016 07:29:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 20 Jun 2016 16:29:03 +0200 Message-Id: <1466432945-28682-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1466432945-28682-1-git-send-email-pbonzini@redhat.com> References: <1466432945-28682-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PATCH 4/6] serial: simplify tsr_retry reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bcketchum@gmail.com, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert --- 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 4196a2e..d232473 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -265,10 +265,8 @@ static void serial_xmit(SerialState *s) s->tsr_retry++; return; } - 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. */