From d59ea0f9a965c3ec6f1b0d1a59c6ebf6e3fe5131 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 22 Dec 2011 05:02:01 +0100 Subject: [PATCH 09/10] virtio-console: Properly initialise class methods RH-Author: Amit Shah Message-id: Patchwork-id: 35927 O-Subject: [RHEL6.3 qemu-kvm PATCH 09/10] virtio-console: Properly initialise class methods Bugzilla: 769528 RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann RH-Acked-by: Markus Armbruster The earlier code really was a hack: initialising class methods in an object init function as noted by Anthony. The motivation for that was to not have the virtio-serial-bus call into the callback functions if there was no chardev backend registered. However, that really wasn't a worthwhile optimisation, and definitely not one that was well-implemented. Get rid of it. Reported-by: Anthony Liguori Signed-off-by: Amit Shah (cherry picked from commit 05e7af694ce00dafdc464ca70306fa9dd6f78dcd) Conflicts: hw/virtio-console.c --- hw/virtio-console.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Signed-off-by: Michal Novotny --- hw/virtio-console.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 09bee01..1545e06 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -141,9 +141,6 @@ static int virtconsole_initfn(VirtIOSerialPort *port) handlers = &chr_handlers_no_flow_control; } qemu_chr_add_handlers(vcon->chr, handlers, vcon); - info->have_data = flush_buf; - info->guest_open = guest_open; - info->guest_close = guest_close; } return 0; @@ -170,6 +167,9 @@ static VirtIOSerialPortInfo virtconsole_info = { .is_console = true, .init = virtconsole_initfn, .exit = virtconsole_exitfn, + .have_data = flush_buf, + .guest_open = guest_open, + .guest_close = guest_close, .qdev.props = (Property[]) { DEFINE_PROP_CHR("chardev", VirtConsole, chr), DEFINE_PROP_END_OF_LIST(), @@ -187,6 +187,9 @@ static VirtIOSerialPortInfo virtserialport_info = { .qdev.size = sizeof(VirtConsole), .init = virtconsole_initfn, .exit = virtconsole_exitfn, + .have_data = flush_buf, + .guest_open = guest_open, + .guest_close = guest_close, .qdev.props = (Property[]) { DEFINE_PROP_CHR("chardev", VirtConsole, chr), DEFINE_PROP_END_OF_LIST(), -- 1.7.7.4