From patchwork Mon May 11 09:34:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48229 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3617D21550 for ; Mon, 11 May 2015 09:36:28 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf37609559wgi.3 for ; Mon, 11 May 2015 02:36:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=f+lLM0+4iMZRBvo8LpUv0bCyFJ8MbBknxy/NBbw+ahI=; b=M9GyvSwtbMA2CUKaw7lYhs7nbGY7KNQU5Iteq2pI1x5qEI1kZ/UI3UdIOmtIwBbYNn N33Tz/yvCTDJnULEtXvgCHFnnU0ZNTJCr8KMcwAEQMexhjdtr1lF+ykb1qwlGgZNNp9n 4+QPQWmVyJ+qdylIWLXtmekPGMdOFcKy3q/X/Tp29cokStGaSh9GNXD4wrqftDjvAijB cwjc1ld7efUAcgUWwNaHkt3thM3dBncalFZWOrJJbVMvC6YWpWx70zFRVElRkHu/6Kvw lD29oU0Kkdq0SsMjgFoSY4MRhdqtY+V5IjioHigdCjiiT6KknKRi9ca/x99F1BSPVw2i sBQA== X-Gm-Message-State: ALoCoQm1HxSFW0Cxf7IURE9inUYNeX68pTBBrhlwYqDM+d2/FeHJ4o7cPRgB3UdHoGYWI3M55SRi X-Received: by 10.194.179.42 with SMTP id dd10mr6978687wjc.7.1431336987562; Mon, 11 May 2015 02:36:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.72 with SMTP id h8ls632244laa.71.gmail; Mon, 11 May 2015 02:36:27 -0700 (PDT) X-Received: by 10.112.169.42 with SMTP id ab10mr7427218lbc.3.1431336987398; Mon, 11 May 2015 02:36:27 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id p3si8060727lap.2.2015.05.11.02.36.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 02:36:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbzk7 with SMTP id zk7so89765692lbb.0 for ; Mon, 11 May 2015 02:36:27 -0700 (PDT) X-Received: by 10.112.182.4 with SMTP id ea4mr7561600lbc.35.1431336987110; Mon, 11 May 2015 02:36:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1400101lbb; Mon, 11 May 2015 02:36:26 -0700 (PDT) X-Received: by 10.140.37.11 with SMTP id q11mr11762157qgq.86.1431336985582; Mon, 11 May 2015 02:36:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k205si5345344qhc.52.2015.05.11.02.36.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 02:36:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:36282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk8O-0007rL-Iw for patch@linaro.org; Mon, 11 May 2015 05:36:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk6P-0005Sa-Nu for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrk6M-0002dm-IN for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:21 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk6M-0002dg-Ab for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:18 -0400 Received: by pabsx10 with SMTP id sx10so105778005pab.3 for ; Mon, 11 May 2015 02:34:17 -0700 (PDT) X-Received: by 10.68.112.195 with SMTP id is3mr17840336pbb.92.1431336857565; Mon, 11 May 2015 02:34:17 -0700 (PDT) Received: from localhost ([180.150.141.243]) by mx.google.com with ESMTPSA id dp7sm12506314pdb.10.2015.05.11.02.34.15 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 02:34:16 -0700 (PDT) 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 Date: Mon, 11 May 2015 17:34:05 +0800 Message-Id: <1431336847-4104-2-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1431336847-4104-1-git-send-email-shannon.zhao@linaro.org> References: <1431336847-4104-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.49 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao This is prepared for using alias property in virtio-balloon-pci and virtio-balloon-ccw. 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, };