From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Amit Shah" <amit.shah@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <aliguori@amazon.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PULL for-2.0 1/4] virtio-console: Fix VIRTIO_CONSOLE() cast macro
Date: Thu, 13 Mar 2014 21:47:12 +0100 [thread overview]
Message-ID: <1394743636-23848-2-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1394743636-23848-1-git-send-email-afaerber@suse.de>
Commit 0399a3819b27083ba69b88a9baa9025facab85bd (virtio-console: QOM
cast cleanup for VirtConsole) broke virtserialport since it shares
functions and state struct with virtconsole. Let virtconsole inherit
from virtserialport, and use virtserialport type for casting.
Note that virtio-serial-port is the abstract base type in
virtio-serial-bus.c, whereas virtserialport is the user-instantiatable
type in virtio-console.c. Therefore using TYPE_VIRTIO_CONSOLE_SERIAL_PORT.
Reported-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/char/virtio-console.c | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index ffd29a8..6c8be0f 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -15,9 +15,9 @@
#include "trace.h"
#include "hw/virtio/virtio-serial.h"
-#define TYPE_VIRTIO_CONSOLE "virtconsole"
+#define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"
#define VIRTIO_CONSOLE(obj) \
- OBJECT_CHECK(VirtConsole, (obj), TYPE_VIRTIO_CONSOLE)
+ OBJECT_CHECK(VirtConsole, (obj), TYPE_VIRTIO_CONSOLE_SERIAL_PORT)
typedef struct VirtConsole {
VirtIOSerialPort parent_obj;
@@ -154,28 +154,16 @@ static void virtconsole_unrealize(DeviceState *dev, Error **errp)
}
}
-static Property virtconsole_properties[] = {
- DEFINE_PROP_CHR("chardev", VirtConsole, chr),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void virtconsole_class_init(ObjectClass *klass, void *data)
{
- DeviceClass *dc = DEVICE_CLASS(klass);
VirtIOSerialPortClass *k = VIRTIO_SERIAL_PORT_CLASS(klass);
k->is_console = true;
- k->realize = virtconsole_realize;
- k->unrealize = virtconsole_unrealize;
- k->have_data = flush_buf;
- k->set_guest_connected = set_guest_connected;
- dc->props = virtconsole_properties;
}
static const TypeInfo virtconsole_info = {
- .name = TYPE_VIRTIO_CONSOLE,
- .parent = TYPE_VIRTIO_SERIAL_PORT,
- .instance_size = sizeof(VirtConsole),
+ .name = "virtconsole",
+ .parent = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
.class_init = virtconsole_class_init,
};
@@ -197,7 +185,7 @@ static void virtserialport_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo virtserialport_info = {
- .name = "virtserialport",
+ .name = TYPE_VIRTIO_CONSOLE_SERIAL_PORT,
.parent = TYPE_VIRTIO_SERIAL_PORT,
.instance_size = sizeof(VirtConsole),
.class_init = virtserialport_class_init,
@@ -205,8 +193,8 @@ static const TypeInfo virtserialport_info = {
static void virtconsole_register_types(void)
{
- type_register_static(&virtconsole_info);
type_register_static(&virtserialport_info);
+ type_register_static(&virtconsole_info);
}
type_init(virtconsole_register_types)
--
1.8.4.5
next prev parent reply other threads:[~2014-03-13 20:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-13 20:47 [Qemu-devel] [PULL for-2.0 0/4] QOM devices patch queue 2014-03-13 Andreas Färber
2014-03-13 20:47 ` Andreas Färber [this message]
2014-03-13 20:47 ` [Qemu-devel] [PULL for-2.0 2/4] virtio-console-test: Test virtserialport as well Andreas Färber
2014-03-13 20:47 ` [Qemu-devel] [PULL for-2.0 3/4] qtest: Fix crash if SIGABRT during qtest_init() Andreas Färber
2014-03-13 20:47 ` [Qemu-devel] [PULL for-2.0 4/4] main-loop: Suppress "I/O thread spun" warnings for qtest Andreas Färber
2014-03-13 22:14 ` [Qemu-devel] [PULL for-2.0 0/4] QOM devices patch queue 2014-03-13 Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394743636-23848-2-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=amit.shah@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).