From 329a9ab8d783dd6d701dceff2da73cc5062a26d5 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 22 Dec 2011 05:01:56 +0100 Subject: [PATCH 04/10] virtio-serial-bus: Simplify handle_output() function RH-Author: Amit Shah Message-id: <9ddc67b9f81e39c311769107a63c327491c64e71.1324529974.git.amit.shah@redhat.com> Patchwork-id: 35922 O-Subject: [RHEL6.3 qemu-kvm PATCH 04/10] virtio-serial-bus: Simplify handle_output() function Bugzilla: 769528 RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann RH-Acked-by: Markus Armbruster There's no code change, just re-arrangement to simplify the function after recent modifications. Reported-by: Juan Quintela Signed-off-by: Amit Shah (cherry picked from commit e9b382b0170ee045295f2ff0ce1009a01a11eb1f) Signed-off-by: Amit Shah --- hw/virtio-serial-bus.c | 12 +++--------- 1 files changed, 3 insertions(+), 9 deletions(-) Signed-off-by: Michal Novotny --- 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 950369c..cda92f3 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -493,25 +493,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) -- 1.7.7.4