From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXpO7-0004ZM-J2 for qemu-devel@nongnu.org; Sat, 27 Sep 2014 06:38:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXpO0-0005YO-V3 for qemu-devel@nongnu.org; Sat, 27 Sep 2014 06:38:03 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:18285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXpO0-0005Si-8F for qemu-devel@nongnu.org; Sat, 27 Sep 2014 06:37:56 -0400 From: "Gonglei (Arei)" Date: Sat, 27 Sep 2014 10:37:23 +0000 Message-ID: <33183CC9F5247A488A2544077AF1902086DDC6DD@SZXEMA503-MBS.china.huawei.com> References: <1411721147-11712-1-git-send-email-arei.gonglei@huawei.com> <20140926162125.71ea6598.cornelia.huck@de.ibm.com> Content-Language: zh-CN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" , Cornelia Huck Cc: "Huangweidong (C)" , "mst@redhat.com" , "armbru@redhat.com" , Luonengjun , "agraf@suse.de" , "qemu-devel@nongnu.org" , "borntraeger@de.ibm.com" , "stefanha@redhat.com" , "pbonzini@redhat.com" , "Huangpeng (Peter)" , "rth@twiddle.net" > > > 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? >=20 Sorry, I'm afraid this is not helpful. Because dev and dev->vdev is differe= nt for different virtio devices, like VirtIOBlkPCI(and its vdev is VirtIOBlock= ),=20 VirtIONetPCI(and its vdev is VirtIONet). They have no the same parameters for above code segment. :)=20 Best regards, -Gonglei