From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "Huangweidong (C)" <weidong.huang@huawei.com>,
"armbru@redhat.com" <armbru@redhat.com>,
Luonengjun <luonengjun@huawei.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"agraf@suse.de" <agraf@suse.de>,
"borntraeger@de.ibm.com" <borntraeger@de.ibm.com>,
"stefanha@redhat.com" <stefanha@redhat.com>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>,
"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
"rth@twiddle.net" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports
Date: Mon, 29 Sep 2014 15:33:32 +0300 [thread overview]
Message-ID: <20140929123332.GA1429@redhat.com> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086DDCCC8@SZXEMA503-MBS.china.huawei.com>
On Mon, Sep 29, 2014 at 12:09:06PM +0000, Gonglei (Arei) wrote:
> > From: Cornelia Huck [mailto:cornelia.huck@de.ibm.com]
> > Sent: Monday, September 29, 2014 6:53 PM
> > Subject: Re: [PATCH RESEND 0/9] virtio: fix virtio child recount in transports
> >
> > On Sat, 27 Sep 2014 10:37:23 +0000
> > "Gonglei (Arei)" <arei.gonglei@huawei.com> wrote:
> >
> > > > > 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. :)
> >
> > Hm...
> >
> > void virtio_instance_init_common(Object *proxydev,
> > DeviceState *vdev,
> > size_t vdevsize,
> > const char *vdevname)
> > {
> > object_initialize(vdev, vdevsize, vdevname);
> > object_property_add_child(proxydev, "virtio-backend", OBJECT(vdev),
> > NULL);
> > object_unref(OBJECT(vdev));
> > qdev_alias_all_properties(vdev, proxydev);
> > }
> >
> > and have the initializers call
> >
> > virtio_instance_init_common(obj, DEVICE(&dev->vdev), sizeof(dev->vdev),
> > TYPE_WHATEVER);
> >
> > ?
>
> OK, it looks good that pass all parameters to one wrapper function.
> Will do this in next version.
>
> Thanks, Cornelia. :)
>
> Best regards,
> -Gonglei
I'm fine with doing the cleanup as a patch on top.
Cornelia, fine with you?
next prev parent reply other threads:[~2014-09-29 12:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 8:45 [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 1/9] virtio-net: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 2/9] virtio: fix virtio-net child refcount in transports arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 3/9] virtio/vhost scsi: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 4/9] virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 5/9] virtio-serial: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 6/9] virtio-serial: fix virtio-serial child refcount in transports arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 7/9] virtio-rng: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 8/9] virtio-rng: fix virtio-rng child refcount in transports arei.gonglei
2014-09-26 8:45 ` [Qemu-devel] [PATCH RESEND 9/9] virtio-balloon: fix virtio-balloon " arei.gonglei
2014-09-26 14:21 ` [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount " Cornelia Huck
2014-09-27 4:46 ` Gonglei (Arei)
2014-09-27 10:37 ` Gonglei (Arei)
2014-09-29 10:53 ` Cornelia Huck
2014-09-29 12:09 ` Gonglei (Arei)
2014-09-29 12:33 ` Michael S. Tsirkin [this message]
2014-09-29 13:10 ` Cornelia Huck
2014-09-30 0:57 ` Gonglei (Arei)
2014-09-29 12:32 ` Paolo Bonzini
2014-09-29 12:37 ` Gonglei (Arei)
2014-09-29 11:32 ` Cornelia Huck
2014-09-29 12:26 ` Gonglei (Arei)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140929123332.GA1429@redhat.com \
--to=mst@redhat.com \
--cc=agraf@suse.de \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=luonengjun@huawei.com \
--cc=pbonzini@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=weidong.huang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).