> > > virtio-net: use aliases instead of duplicate qdev properties > > > virtio: fix virtio-net child refcount in transports > > > virtio/vhost scsi: use aliases instead of duplicate qdev properties > > > virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in > > > transports > > > virtio-serial: use aliases instead of duplicate qdev properties > > > virtio-serial: fix virtio-serial child refcount in transports > > > virtio-rng: use aliases instead of duplicate qdev properties > > > virtio-rng: fix virtio-rng child refcount in transports > > > virtio-balloon: fix virtio-balloon child refcount in transports > > > > > > hw/s390x/s390-virtio-bus.c | 16 ++++++++++------ > > > hw/s390x/virtio-ccw.c | 18 +++++++++++------- > > > hw/virtio/virtio-pci.c | 18 +++++++++++------- > > > 3 files changed, 32 insertions(+), 20 deletions(-) > > > > One thing I noticed is that the various devices end up with similar > > code in the end: > > > > object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_WHATEVER); > > object_property_add_child(obj, "virtio-backend", > OBJECT(&dev->vdev), > > NULL); > > object_unref(OBJECT(&dev->vdev)); > > qdev_alias_all_properties(DEVICE(&dev->vdev), obj); > > > > Would it make sense to add a helper function for that? >
Sorry, I'm afraid this is not helpful. Because dev and dev->vdev is different for different virtio devices, like VirtIOBlkPCI(and its vdev is VirtIOBlock), VirtIONetPCI(and its vdev is VirtIONet). They have no the same parameters for above code segment. :) Best regards, -Gonglei