From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrkiZ-0008BQ-2c for qemu-devel@nongnu.org; Mon, 11 May 2015 06:13:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YrkiU-0000xY-5Z for qemu-devel@nongnu.org; Mon, 11 May 2015 06:13:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YrkiU-0000xO-0B for qemu-devel@nongnu.org; Mon, 11 May 2015 06:13:42 -0400 Message-ID: <555080CF.5040209@redhat.com> Date: Mon, 11 May 2015 12:13:35 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1431336847-4104-1-git-send-email-shannon.zhao@linaro.org> <1431336847-4104-2-git-send-email-shannon.zhao@linaro.org> In-Reply-To: <1431336847-4104-2-git-send-email-shannon.zhao@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] hw/virtio/virtio-balloon: move adding property to virtio_balloon_instance_init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: shannon.zhao@linaro.org, qemu-devel@nongnu.org, peter.maydell@linaro.org, cornelia.huck@de.ibm.com, mst@redhat.com Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com, christoffer.dall@linaro.org, zhaoshenglong@huawei.com On 11/05/2015 11:34, shannon.zhao@linaro.org wrote: > From: Shannon Zhao > > This is prepared for using alias property in virtio-balloon-pci and > virtio-balloon-ccw. English note: "This prepares for..." Can be fixed by the committer. Paolo > Signed-off-by: Shannon Zhao > Signed-off-by: Shannon Zhao > --- > hw/virtio/virtio-balloon.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c > index 484c3c3..cfff542 100644 > --- a/hw/virtio/virtio-balloon.c > +++ b/hw/virtio/virtio-balloon.c > @@ -396,14 +396,6 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp) > > register_savevm(dev, "virtio-balloon", -1, 1, > virtio_balloon_save, virtio_balloon_load, s); > - > - object_property_add(OBJECT(dev), "guest-stats", "guest statistics", > - balloon_stats_get_all, NULL, NULL, s, NULL); > - > - object_property_add(OBJECT(dev), "guest-stats-polling-interval", "int", > - balloon_stats_get_poll_interval, > - balloon_stats_set_poll_interval, > - NULL, s, NULL); > } > > static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp) > @@ -417,6 +409,19 @@ static void virtio_balloon_device_unrealize(DeviceState *dev, Error **errp) > virtio_cleanup(vdev); > } > > +static void virtio_balloon_instance_init(Object *obj) > +{ > + VirtIOBalloon *s = VIRTIO_BALLOON(obj); > + > + object_property_add(obj, "guest-stats", "guest statistics", > + balloon_stats_get_all, NULL, NULL, s, NULL); > + > + object_property_add(obj, "guest-stats-polling-interval", "int", > + balloon_stats_get_poll_interval, > + balloon_stats_set_poll_interval, > + NULL, s, NULL); > +} > + > static Property virtio_balloon_properties[] = { > DEFINE_PROP_END_OF_LIST(), > }; > @@ -441,6 +446,7 @@ static const TypeInfo virtio_balloon_info = { > .name = TYPE_VIRTIO_BALLOON, > .parent = TYPE_VIRTIO_DEVICE, > .instance_size = sizeof(VirtIOBalloon), > + .instance_init = virtio_balloon_instance_init, > .class_init = virtio_balloon_class_init, > }; > >