diff options
author | KONRAD Frederic <fred.konrad@greensocs.com> | 2013-04-09 14:53:32 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-04-15 10:22:05 -0500 |
commit | 55169140020c431bae446280858bd25e1e54f366 (patch) | |
tree | 8ef7f21f406114cd93f1d23dd5766640961422ac /hw/s390x/s390-virtio-bus.c | |
parent | f7f7464afdb9f6f792de080ca4b3c520168513ad (diff) |
virtio-serial-s390: switch to the new API.
Here the virtio-serial-s390 is modified for the new API. The device
virtio-serial-s390 extends virtio-s390-device as before. It creates and
connects a virtio-serial during the init. The properties are not
modified.
Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1365512016-21944-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/s390x/s390-virtio-bus.c')
-rw-r--r-- | hw/s390x/s390-virtio-bus.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 6d857b93f9..a71c145d4e 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -181,27 +181,36 @@ static void s390_virtio_blk_instance_init(Object *obj) object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); } -static int s390_virtio_serial_init(VirtIOS390Device *dev) +static int s390_virtio_serial_init(VirtIOS390Device *s390_dev) { + VirtIOSerialS390 *dev = VIRTIO_SERIAL_S390(s390_dev); + DeviceState *vdev = DEVICE(&dev->vdev); + DeviceState *qdev = DEVICE(s390_dev); VirtIOS390Bus *bus; - VirtIODevice *vdev; int r; - bus = DO_UPCAST(VirtIOS390Bus, bus, dev->qdev.parent_bus); + bus = DO_UPCAST(VirtIOS390Bus, bus, qdev->parent_bus); - vdev = virtio_serial_init((DeviceState *)dev, &dev->serial); - if (!vdev) { + qdev_set_parent_bus(vdev, BUS(&s390_dev->bus)); + if (qdev_init(vdev) < 0) { return -1; } - r = s390_virtio_device_init(dev, vdev); + r = s390_virtio_device_init(s390_dev, VIRTIO_DEVICE(vdev)); if (!r) { - bus->console = dev; + bus->console = s390_dev; } return r; } +static void s390_virtio_serial_instance_init(Object *obj) +{ + VirtIOSerialS390 *dev = VIRTIO_SERIAL_S390(obj); + object_initialize(OBJECT(&dev->vdev), TYPE_VIRTIO_SERIAL); + object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); +} + static int s390_virtio_scsi_init(VirtIOS390Device *s390_dev) { VirtIOSCSIS390 *dev = VIRTIO_SCSI_S390(s390_dev); @@ -465,7 +474,7 @@ static const TypeInfo s390_virtio_blk = { }; static Property s390_virtio_serial_properties[] = { - DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtIOS390Device, serial), + DEFINE_VIRTIO_SERIAL_PROPERTIES(VirtIOSerialS390, vdev.serial), DEFINE_PROP_END_OF_LIST(), }; @@ -479,9 +488,10 @@ static void s390_virtio_serial_class_init(ObjectClass *klass, void *data) } static const TypeInfo s390_virtio_serial = { - .name = "virtio-serial-s390", + .name = TYPE_VIRTIO_SERIAL_S390, .parent = TYPE_VIRTIO_S390_DEVICE, - .instance_size = sizeof(VirtIOS390Device), + .instance_size = sizeof(VirtIOSerialS390), + .instance_init = s390_virtio_serial_instance_init, .class_init = s390_virtio_serial_class_init, }; |