From patchwork Mon Jun 2 13:25:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 354884 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 8D829140085 for ; Mon, 2 Jun 2014 23:41:08 +1000 (EST) Received: from localhost ([::1]:45180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSU6-0004Vh-88 for incoming@patchwork.ozlabs.org; Mon, 02 Jun 2014 09:41:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSHr-0004Qq-1B for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrSHl-00088E-V3 for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrSHl-000880-Mv for qemu-devel@nongnu.org; Mon, 02 Jun 2014 09:28:21 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s52DSKNe007964 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Jun 2014 09:28:20 -0400 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s52DRhgI026245; Mon, 2 Jun 2014 09:28:19 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 Jun 2014 15:25:21 +0200 Message-Id: <1401715529-636-26-git-send-email-imammedo@redhat.com> In-Reply-To: <1401715529-636-1-git-send-email-imammedo@redhat.com> References: <1401715529-636-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: lcapitulino@redhat.com, aliguori@amazon.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v4 25/33] pc: ich9 lpc: make it work with global/compat properties 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 Propeties of object should be available after its instances_init() callback is finished and not added in PCIDeviceClass.init which is roughly corresponds to realize() method. Moving properties adding into instances_init will fix missing property error when global/compat property mechanism is used. Signed-off-by: Igor Mammedov Acked-by: Peter Crosthwaite --- hw/isa/lpc_ich9.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 51ce12d..46de3b6 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -563,7 +563,14 @@ static void ich9_lpc_add_properties(ICH9LPCState *lpc) ich9_pm_add_properties(OBJECT(lpc), &lpc->pm, NULL); } -static int ich9_lpc_initfn(PCIDevice *d) +static void ich9_lpc_initfn(Object *obj) +{ + ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj); + + ich9_lpc_add_properties(lpc); +} + +static int ich9_lpc_init(PCIDevice *d) { ICH9LPCState *lpc = ICH9_LPC_DEVICE(d); ISABus *isa_bus; @@ -589,9 +596,6 @@ static int ich9_lpc_initfn(PCIDevice *d) memory_region_add_subregion_overlap(pci_address_space_io(d), ICH9_RST_CNT_IOPORT, &lpc->rst_cnt_mem, 1); - - ich9_lpc_add_properties(lpc); - return 0; } @@ -642,7 +646,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->reset = ich9_lpc_reset; - k->init = ich9_lpc_initfn; + k->init = ich9_lpc_init; dc->vmsd = &vmstate_ich9_lpc; k->config_write = ich9_lpc_config_write; dc->desc = "ICH9 LPC bridge"; @@ -661,6 +665,7 @@ static const TypeInfo ich9_lpc_info = { .name = TYPE_ICH9_LPC_DEVICE, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(struct ICH9LPCState), + .instance_init = ich9_lpc_initfn, .class_init = ich9_lpc_class_init, };