Patchwork [4/7] virtio-serial-bus: Simplify handle_output() function

login
register
mail settings
Submitter Amit Shah
Date March 21, 2011, 1:09 p.m.
Message ID <e9b382b0170ee045295f2ff0ce1009a01a11eb1f.1300712809.git.amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/87773/
State New
Headers show

Comments

Amit Shah - March 21, 2011, 1:09 p.m.
There's no code change, just re-arrangement to simplify the function
after recent modifications.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio-serial-bus.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)

Patch

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)