From patchwork Tue Oct 7 08:00:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 397174 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 DA23614009E for ; Tue, 7 Oct 2014 19:18:39 +1100 (EST) Received: from localhost ([::1]:57295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbPyf-0004fp-Lr for incoming@patchwork.ozlabs.org; Tue, 07 Oct 2014 04:18:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbPj7-0003yC-IK for qemu-devel@nongnu.org; Tue, 07 Oct 2014 04:03:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbPif-0005Ti-Ku for qemu-devel@nongnu.org; Tue, 07 Oct 2014 04:02:33 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:31612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbPie-0005P1-R3 for qemu-devel@nongnu.org; Tue, 07 Oct 2014 04:02:05 -0400 Received: from 172.24.2.119 (EHLO szxeml450-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CAJ03070; Tue, 07 Oct 2014 16:01:21 +0800 (CST) Received: from localhost (10.177.19.102) by szxeml450-hub.china.huawei.com (10.82.67.193) with Microsoft SMTP Server id 14.3.158.1; Tue, 7 Oct 2014 16:01:12 +0800 From: To: Date: Tue, 7 Oct 2014 16:00:28 +0800 Message-ID: <1412668838-8656-25-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 In-Reply-To: <1412668838-8656-1-git-send-email-arei.gonglei@huawei.com> References: <1412668838-8656-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: peter.maydell@linaro.org, weidong.huang@huawei.com, mst@redhat.com, aik@ozlabs.ru, armbru@redhat.com, kraxel@redhat.com, dmitry@daynix.com, akong@redhat.com, agraf@suse.de, Gonglei , lersek@redhat.com, ehabkost@redhat.com, marcel.a@redhat.com, somlo@cmu.edu, luonengjun@huawei.com, peter.huangpeng@huawei.com, alex.williamson@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, rth@twiddle.net, kwolf@redhat.com, peter.crosthwaite@xilinx.com, chenliang88@huawei.com, imammedo@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v11 24/34] scsi: 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 Reviewed-by: Gerd Hoffmann --- hw/scsi/scsi-bus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 0f3e039..59e8f90 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -2016,6 +2016,16 @@ static void scsi_device_class_init(ObjectClass *klass, void *data) k->props = scsi_props; } +static void scsi_dev_instance_init(Object *obj) +{ + DeviceState *dev = DEVICE(obj); + SCSIDevice *s = DO_UPCAST(SCSIDevice, qdev, dev); + + device_add_bootindex_property(obj, &s->conf.bootindex, + "bootindex", NULL, + &s->qdev, NULL); +} + static const TypeInfo scsi_device_type_info = { .name = TYPE_SCSI_DEVICE, .parent = TYPE_DEVICE, @@ -2023,6 +2033,7 @@ static const TypeInfo scsi_device_type_info = { .abstract = true, .class_size = sizeof(SCSIDeviceClass), .class_init = scsi_device_class_init, + .instance_init = scsi_dev_instance_init, }; static void scsi_register_types(void)