virtio-serial-bus: Simplify handle_output() function
authorAmit Shah <amit.shah@redhat.com>
Thu, 3 Mar 2011 07:58:55 +0000 (13:28 +0530)
committerAmit Shah <amit.shah@redhat.com>
Mon, 21 Mar 2011 11:25:12 +0000 (16:55 +0530)
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

index c6feb4316b5e9aa5c944b25b4fea653332ee7eb3..a82fbe9ba4036dfe7130b6caf188ce4921dbc26e 100644 (file)
@@ -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)