From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOCXJ-0000XW-FT for qemu-devel@nongnu.org; Thu, 13 Mar 2014 16:47:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOCXD-0000ug-Gg for qemu-devel@nongnu.org; Thu, 13 Mar 2014 16:47:29 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39054 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOCXD-0000uW-AP for qemu-devel@nongnu.org; Thu, 13 Mar 2014 16:47:23 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 13 Mar 2014 21:47:12 +0100 Message-Id: <1394743636-23848-2-git-send-email-afaerber@suse.de> In-Reply-To: <1394743636-23848-1-git-send-email-afaerber@suse.de> References: <1394743636-23848-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 1/4] virtio-console: Fix VIRTIO_CONSOLE() cast macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori , "Michael S. Tsirkin" 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 Acked-by: Richard W.M. Jones Signed-off-by: Andreas F=C3=A4rber --- 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" =20 -#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) =20 typedef struct VirtConsole { VirtIOSerialPort parent_obj; @@ -154,28 +154,16 @@ static void virtconsole_unrealize(DeviceState *dev,= Error **errp) } } =20 -static Property virtconsole_properties[] =3D { - DEFINE_PROP_CHR("chardev", VirtConsole, chr), - DEFINE_PROP_END_OF_LIST(), -}; - static void virtconsole_class_init(ObjectClass *klass, void *data) { - DeviceClass *dc =3D DEVICE_CLASS(klass); VirtIOSerialPortClass *k =3D VIRTIO_SERIAL_PORT_CLASS(klass); =20 k->is_console =3D true; - k->realize =3D virtconsole_realize; - k->unrealize =3D virtconsole_unrealize; - k->have_data =3D flush_buf; - k->set_guest_connected =3D set_guest_connected; - dc->props =3D virtconsole_properties; } =20 static const TypeInfo virtconsole_info =3D { - .name =3D TYPE_VIRTIO_CONSOLE, - .parent =3D TYPE_VIRTIO_SERIAL_PORT, - .instance_size =3D sizeof(VirtConsole), + .name =3D "virtconsole", + .parent =3D TYPE_VIRTIO_CONSOLE_SERIAL_PORT, .class_init =3D virtconsole_class_init, }; =20 @@ -197,7 +185,7 @@ static void virtserialport_class_init(ObjectClass *kl= ass, void *data) } =20 static const TypeInfo virtserialport_info =3D { - .name =3D "virtserialport", + .name =3D TYPE_VIRTIO_CONSOLE_SERIAL_PORT, .parent =3D TYPE_VIRTIO_SERIAL_PORT, .instance_size =3D sizeof(VirtConsole), .class_init =3D virtserialport_class_init, @@ -205,8 +193,8 @@ static const TypeInfo virtserialport_info =3D { =20 static void virtconsole_register_types(void) { - type_register_static(&virtconsole_info); type_register_static(&virtserialport_info); + type_register_static(&virtconsole_info); } =20 type_init(virtconsole_register_types) --=20 1.8.4.5