qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: shannon.zhao@linaro.org
To: qemu-devel@nongnu.org, peter.maydell@linaro.org,
	cornelia.huck@de.ibm.com, mst@redhat.com, pbonzini@redhat.com
Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com,
	christoffer.dall@linaro.org, zhaoshenglong@huawei.com
Subject: [Qemu-devel] [PATCH 1/3] hw/virtio/virtio-balloon: move adding property to virtio_balloon_instance_init
Date: Mon, 11 May 2015 17:34:05 +0800	[thread overview]
Message-ID: <1431336847-4104-2-git-send-email-shannon.zhao@linaro.org> (raw)
In-Reply-To: <1431336847-4104-1-git-send-email-shannon.zhao@linaro.org>

From: Shannon Zhao <shannon.zhao@linaro.org>

This is prepared for using alias property in virtio-balloon-pci and
virtio-balloon-ccw.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 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,
 };
 
-- 
2.1.0

  reply	other threads:[~2015-05-11  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  9:34 [Qemu-devel] [PATCH 0/3] virtio-balloon: use alias property shannon.zhao
2015-05-11  9:34 ` shannon.zhao [this message]
2015-05-11 10:13   ` [Qemu-devel] [PATCH 1/3] hw/virtio/virtio-balloon: move adding property to virtio_balloon_instance_init Paolo Bonzini
2015-05-11  9:34 ` [Qemu-devel] [PATCH 2/3] hw/virtio/virtio-pci: use alias property for virtio-balloon-pci shannon.zhao
2015-05-11  9:34 ` [Qemu-devel] [PATCH 3/3] hw/s390x/virtio-ccw: use alias property for virtio-balloon-ccw shannon.zhao
2015-05-11 10:14 ` [Qemu-devel] [PATCH 0/3] virtio-balloon: use alias property Paolo Bonzini
2015-05-11 12:02 ` Cornelia Huck
2015-05-20  1:09 ` Shannon Zhao

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=1431336847-4104-2-git-send-email-shannon.zhao@linaro.org \
    --to=shannon.zhao@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=cornelia.huck@de.ibm.com \
    --cc=hangaohuai@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zhaoshenglong@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).