From patchwork Mon May 11 09:34:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48228 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 911F821550 for ; Mon, 11 May 2015 09:35:20 +0000 (UTC) Received: by layy10 with SMTP id y10sf40119314lay.0 for ; Mon, 11 May 2015 02:35:19 -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=YT+jHP7EufWXAjz9+opdhBBgR4e3Iq1FaCZIWY1PCxM=; b=byw3W6gQCsEdgKVOGLbzi+eFBDuptuznfwee0I6zK1tdpRrfhdAtG4N+XHTCR1iLv+ 9agMOYSlEqnLGK/Kg5nUUyL/JPmjL4Vua12NAcm35rEeYsfcHMcVSj/dAczXW+F7zw+q avwRsF08VXzeENzn2OI1NpirD7GTGJVvEmoaS4KBfP2nuqAKdO1h597Kx1TgB/XYnMaO UWcG1Wu8eLGbUFu7G/+CCWDukO7v5lH3hnLQV0xvnHK8k4cXW12xGuXIeYKrA+mtKeHS xWgJ2B7/Cp+tKET5fEQDc7bjEzQuzIssd1CM2frdwmwnGXWkSEqqWECb2eQNCmnZcSOY MOpg== X-Gm-Message-State: ALoCoQn55fhpBKIC9uUofsBBGVIjBqoJ1kD1q4UUU6VtRg6HZZDE3oD+NpBjhIoJ1HObOgNfHkWD X-Received: by 10.194.143.98 with SMTP id sd2mr6992816wjb.6.1431336919523; Mon, 11 May 2015 02:35:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.40 with SMTP id v8ls558333laj.88.gmail; Mon, 11 May 2015 02:35:19 -0700 (PDT) X-Received: by 10.112.180.137 with SMTP id do9mr7245487lbc.91.1431336919367; Mon, 11 May 2015 02:35:19 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id ez8si8048433lbc.64.2015.05.11.02.35.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 02:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by labbd9 with SMTP id bd9so89160803lab.2 for ; Mon, 11 May 2015 02:35:19 -0700 (PDT) X-Received: by 10.112.150.100 with SMTP id uh4mr7275279lbb.112.1431336919199; Mon, 11 May 2015 02:35:19 -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 hn6csp1399664lbb; Mon, 11 May 2015 02:35:18 -0700 (PDT) X-Received: by 10.52.26.132 with SMTP id l4mr6691217vdg.72.1431336917894; Mon, 11 May 2015 02:35:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id rt16si10860274vdb.67.2015.05.11.02.35.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 02:35:17 -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]:36269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk7I-0006O9-QT for patch@linaro.org; Mon, 11 May 2015 05:35:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk6U-0005Zf-SI for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yrk6R-0002ed-Gm for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:26 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yrk6R-0002eX-C7 for qemu-devel@nongnu.org; Mon, 11 May 2015 05:34:23 -0400 Received: by pabtp1 with SMTP id tp1so105808922pab.2 for ; Mon, 11 May 2015 02:34:22 -0700 (PDT) X-Received: by 10.70.33.33 with SMTP id o1mr17864951pdi.132.1431336862785; Mon, 11 May 2015 02:34:22 -0700 (PDT) Received: from localhost ([180.150.141.243]) by mx.google.com with ESMTPSA id v3sm12481319pbs.18.2015.05.11.02.34.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 02:34:21 -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:06 +0800 Message-Id: <1431336847-4104-3-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.47 Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com, christoffer.dall@linaro.org, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH 2/3] hw/virtio/virtio-pci: use alias property for virtio-balloon-pci 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.215.45 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 Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/virtio/virtio-pci.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c7c3f72..2dae8db 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1199,32 +1199,6 @@ static const TypeInfo vhost_scsi_pci_info = { /* virtio-balloon-pci */ -static void balloon_pci_stats_get_all(Object *obj, struct Visitor *v, - void *opaque, const char *name, - Error **errp) -{ - VirtIOBalloonPCI *dev = opaque; - object_property_get(OBJECT(&dev->vdev), v, "guest-stats", errp); -} - -static void balloon_pci_stats_get_poll_interval(Object *obj, struct Visitor *v, - void *opaque, const char *name, - Error **errp) -{ - VirtIOBalloonPCI *dev = opaque; - object_property_get(OBJECT(&dev->vdev), v, "guest-stats-polling-interval", - errp); -} - -static void balloon_pci_stats_set_poll_interval(Object *obj, struct Visitor *v, - void *opaque, const char *name, - Error **errp) -{ - VirtIOBalloonPCI *dev = opaque; - object_property_set(OBJECT(&dev->vdev), v, "guest-stats-polling-interval", - errp); -} - static Property virtio_balloon_pci_properties[] = { DEFINE_PROP_UINT32("class", VirtIOPCIProxy, class_code, 0), DEFINE_PROP_END_OF_LIST(), @@ -1261,16 +1235,14 @@ static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data) static void virtio_balloon_pci_instance_init(Object *obj) { VirtIOBalloonPCI *dev = VIRTIO_BALLOON_PCI(obj); + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BALLOON); - object_property_add(obj, "guest-stats", "guest statistics", - balloon_pci_stats_get_all, NULL, NULL, dev, - NULL); - - object_property_add(obj, "guest-stats-polling-interval", "int", - balloon_pci_stats_get_poll_interval, - balloon_pci_stats_set_poll_interval, - NULL, dev, NULL); + object_property_add_alias(obj, "guest-stats", OBJECT(&dev->vdev), + "guest-stats", &error_abort); + object_property_add_alias(obj, "guest-stats-polling-interval", + OBJECT(&dev->vdev), + "guest-stats-polling-interval", &error_abort); } static const TypeInfo virtio_balloon_pci_info = {