From patchwork Wed Sep 10 12:04:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 387701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 55E20140131 for ; Wed, 10 Sep 2014 22:06:37 +1000 (EST) Received: from localhost ([::1]:55708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRgfT-0003di-4l for incoming@patchwork.ozlabs.org; Wed, 10 Sep 2014 08:06:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRgeQ-00020a-VG for qemu-devel@nongnu.org; Wed, 10 Sep 2014 08:05:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRgeL-0007pd-Rf for qemu-devel@nongnu.org; Wed, 10 Sep 2014 08:05:30 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:22352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRgeL-0007pE-1I for qemu-devel@nongnu.org; Wed, 10 Sep 2014 08:05:25 -0400 Received: from 172.24.2.119 (EHLO SZXEML454-HUB.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id AUD82948; Wed, 10 Sep 2014 20:05:06 +0800 (CST) Received: from localhost (10.177.19.102) by SZXEML454-HUB.china.huawei.com (10.82.67.197) with Microsoft SMTP Server id 14.3.158.1; Wed, 10 Sep 2014 20:05:00 +0800 From: To: Date: Wed, 10 Sep 2014 20:04:09 +0800 Message-ID: <1410350664-1376-16-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 In-Reply-To: <1410350664-1376-1-git-send-email-arei.gonglei@huawei.com> References: <1410350664-1376-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020207.54103E72.01F2,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: 85e5a3fa00cb17ba9f5b3524b6053ad4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.66 Cc: chenliang88@huawei.com, weidong.huang@huawei.com, mst@redhat.com, aik@ozlabs.ru, hutao@cn.fujitsu.com, armbru@redhat.com, kraxel@redhat.com, akong@redhat.com, agraf@suse.de, Gonglei , aliguori@amazon.com, ehabkost@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, hani@linux.com, stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, kwolf@redhat.com, peter.crosthwaite@xilinx.com, imammedo@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v8 15/30] vmxnet3: add bootindex to qom property 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gonglei Add a qom property with the same name 'bootindex', when we remove it form qdev property, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei --- hw/net/spapr_llan.c | 22 ++++------------------ hw/net/vmxnet3.c | 8 ++++++++ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index b89496a..0ff159b 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -226,27 +226,13 @@ static int spapr_vlan_init(VIOsPAPRDevice *sdev) return 0; } -static void spapr_vlan_get_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) -{ - VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(obj); - - get_bootindex(&dev->nicconf.bootindex, v, name, errp); -} - -static void spapr_vlan_set_bootindex(Object *obj, Visitor *v, void *opaque, - const char *name, Error **errp) +static void spapr_vlan_instance_init(Object *obj) { VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(obj); - set_bootindex(&dev->nicconf.bootindex, v, name, errp); -} - -static void spapr_vlan_instance_init(Object *obj) -{ - object_property_add(obj, "bootindex", "int", - spapr_vlan_get_bootindex, - spapr_vlan_set_bootindex, NULL, NULL, NULL); + device_add_bootindex_property(obj, &dev->nicconf.bootindex, + "bootindex", "", + DEVICE(dev), NULL); } void spapr_vlan_create(VIOsPAPRBus *bus, NICInfo *nd) diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index f246fa1..88e9d9c 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -2177,6 +2177,13 @@ static int vmxnet3_pci_init(PCIDevice *pci_dev) return 0; } +static void vmxnet3_instance_init(Object *obj) +{ + VMXNET3State *s = VMXNET3(obj); + device_add_bootindex_property(obj, &s->conf.bootindex, + "bootindex", "/ethernet-phy@0", + DEVICE(obj), NULL); +} static void vmxnet3_pci_uninit(PCIDevice *pci_dev) { @@ -2524,6 +2531,7 @@ static const TypeInfo vmxnet3_info = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(VMXNET3State), .class_init = vmxnet3_class_init, + .instance_init = vmxnet3_instance_init, }; static void vmxnet3_register_types(void)