Patchwork [4/8] virtio-serial: Bus info message for showing port's throttled status

login
register
mail settings
Submitter Amit Shah
Date April 7, 2010, 9:02 p.m.
Message ID <1270674156-9345-5-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/49645/
State New
Headers show

Comments

Amit Shah - April 7, 2010, 9:02 p.m.
Show whether a port is throttled in 'info qtree'.

Also reduce LOC by 1 by assigning 'throttled' status just once.

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

Patch

diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index c0044b3..9c3a913 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -240,12 +240,11 @@  void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle)
         return;
     }
 
+    port->throttled = throttle;
     if (throttle) {
-        port->throttled = true;
         return;
     }
 
-    port->throttled = false;
     flush_queued_data(port, false);
 }
 
@@ -595,6 +594,8 @@  static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
                    indent, "", port->guest_connected);
     monitor_printf(mon, "%*s dev-prop-int: host_connected: %d\n",
                    indent, "", port->host_connected);
+    monitor_printf(mon, "%*s dev-prop-int: throttled: %d\n",
+                   indent, "", port->throttled);
 }
 
 /* This function is only used if a port id is not provided by the user */