From f7713c12dbe9a3f3a139ff7c5a534f0f6bcda84f Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 22 Dec 2011 05:02:02 +0100 Subject: [PATCH 10/10] virtio-serial-bus: Ports are expected to implement 'have_data' callback RH-Author: Amit Shah Message-id: <511a813cb652c2689c430769de37a8e190565cdc.1324529974.git.amit.shah@redhat.com> Patchwork-id: 35928 O-Subject: [RHEL6.3 qemu-kvm PATCH 10/10] virtio-serial-bus: Ports are expected to implement 'have_data' callback Bugzilla: 769528 RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann RH-Acked-by: Markus Armbruster 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 (cherry picked from commit 03ecd2c80a64d030a22fe67cc7a60f24e17ff211) Signed-off-by: Amit Shah --- hw/virtio-serial-bus.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Signed-off-by: Michal Novotny --- hw/virtio-serial-bus.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index ba53b7f..291a706 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -501,13 +501,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; } @@ -797,6 +795,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 -- 1.7.7.4