From patchwork Thu Mar 10 06:09:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 86190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 74950B6F94 for ; Thu, 10 Mar 2011 17:11:22 +1100 (EST) Received: from localhost ([127.0.0.1]:39109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxZ5i-0003fO-TI for incoming@patchwork.ozlabs.org; Thu, 10 Mar 2011 01:11:19 -0500 Received: from [140.186.70.92] (port=41277 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxZ45-0003cX-T2 for qemu-devel@nongnu.org; Thu, 10 Mar 2011 01:09:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxZ44-0007dF-Os for qemu-devel@nongnu.org; Thu, 10 Mar 2011 01:09:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxZ44-0007cz-Gd for qemu-devel@nongnu.org; Thu, 10 Mar 2011 01:09:36 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2A69ZWG021052 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Mar 2011 01:09:35 -0500 Received: from localhost (dhcp193-58.pnq.redhat.com [10.65.193.58]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2A69XTn029440; Thu, 10 Mar 2011 01:09:34 -0500 From: Amit Shah To: Anthony Liguori Date: Thu, 10 Mar 2011 11:39:18 +0530 Message-Id: <510881da231fc2e2905087d85287cb1d60fea97d.1299737220.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Amit Shah , qemu list Subject: [Qemu-devel] [PULL (resend, rebase) 4/5] virtio-serial-bus: Simplify handle_output() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There's no code change, just re-arrangement to simplify the function after recent modifications. Reported-by: Juan Quintela Signed-off-by: Amit Shah Reviewed-by: Juan Quintela --- hw/virtio-serial-bus.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index c6feb43..a82fbe9 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -442,25 +442,19 @@ static void handle_output(VirtIODevice *vdev, VirtQueue *vq) { VirtIOSerial *vser; VirtIOSerialPort *port; - bool discard; vser = DO_UPCAST(VirtIOSerial, vdev, vdev); port = find_port_by_vq(vser, vq); - discard = false; if (!port || !port->host_connected || !port->info->have_data) { - discard = true; - } - - if (discard) { discard_vq_data(vq, vdev); return; } - if (port->throttled) { + + if (!port->throttled) { + do_flush_queued_data(port, vq, vdev); return; } - - do_flush_queued_data(port, vq, vdev); } static void handle_input(VirtIODevice *vdev, VirtQueue *vq)