aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-serial-bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio-serial-bus.c')
-rw-r--r--hw/virtio-serial-bus.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 70f5d48706..50a6d7fc16 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -837,15 +837,6 @@ static int virtser_port_qdev_exit(DeviceState *qdev)
return 0;
}
-void virtio_serial_port_qdev_register(DeviceInfo *info)
-{
- info->init = virtser_port_qdev_init;
- info->bus_info = &virtser_bus_info;
- info->exit = virtser_port_qdev_exit;
- info->unplug = qdev_simple_unplug_cb;
- qdev_register_subclass(info, TYPE_VIRTIO_SERIAL_PORT);
-}
-
VirtIODevice *virtio_serial_init(DeviceState *dev, virtio_serial_conf *conf)
{
VirtIOSerial *vser;
@@ -940,12 +931,22 @@ void virtio_serial_exit(VirtIODevice *vdev)
virtio_cleanup(vdev);
}
+static void virtio_serial_port_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = virtser_port_qdev_init;
+ k->bus_info = &virtser_bus_info;
+ k->exit = virtser_port_qdev_exit;
+ k->unplug = qdev_simple_unplug_cb;
+}
+
static TypeInfo virtio_serial_port_type_info = {
.name = TYPE_VIRTIO_SERIAL_PORT,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VirtIOSerialPort),
.abstract = true,
.class_size = sizeof(VirtIOSerialPortClass),
+ .class_init = virtio_serial_port_class_init,
};
static void virtio_serial_register_devices(void)