summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2011-12-21 12:28:29 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-21 15:00:29 -0600
commit03ecd2c80a64d030a22fe67cc7a60f24e17ff211 (patch)
tree32f1318500eef8f61fc3239998d1bf5fd8dbd373
parent05e7af694ce00dafdc464ca70306fa9dd6f78dcd (diff)
downloadqemu-03ecd2c80a64d030a22fe67cc7a60f24e17ff211.zip
virtio-serial-bus: Ports are expected to implement 'have_data' callback
There's no need to check if ports can accept any incoming data from the guest each time the guest sends data. Check if the port implements such functionality during port initialisation. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/virtio-serial-bus.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index a4825b9eeb..fe0233f6f1 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -466,13 +466,11 @@ static void handle_output(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSerial *vser;
VirtIOSerialPort *port;
- VirtIOSerialPortInfo *info;
vser = DO_UPCAST(VirtIOSerial, vdev, vdev);
port = find_port_by_vq(vser, vq);
- info = port ? DO_UPCAST(VirtIOSerialPortInfo, qdev, port->dev.info) : NULL;
- if (!port || !port->host_connected || !info->have_data) {
+ if (!port || !port->host_connected) {
discard_vq_data(vq, vdev);
return;
}
@@ -746,6 +744,8 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
port->vser = bus->vser;
port->bh = qemu_bh_new(flush_queued_data_bh, port);
+ assert(info->have_data);
+
/*
* Is the first console port we're seeing? If so, put it up at
* location 0. This is done for backward compatibility (old