From patchwork Wed Jan 30 09:43:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 216803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 52AE42C0094 for ; Wed, 30 Jan 2013 20:44:32 +1100 (EST) Received: from localhost ([::1]:53678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0UDU-0006nH-Ea for incoming@patchwork.ozlabs.org; Wed, 30 Jan 2013 04:44:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:34061) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0UDC-0006dY-Lb for qemu-devel@nongnu.org; Wed, 30 Jan 2013 04:44:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0UDB-0008Be-Ai for qemu-devel@nongnu.org; Wed, 30 Jan 2013 04:44:10 -0500 Received: from mout.web.de ([212.227.17.11]:59335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0UD6-0008A8-V7; Wed, 30 Jan 2013 04:44:05 -0500 Received: from localhost.localdomain ([84.148.60.179]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0LaTaN-1Ui1tM2yS7-00mLKJ; Wed, 30 Jan 2013 10:44:04 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 30 Jan 2013 10:43:54 +0100 Message-Id: <1359539035-31698-3-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359539035-31698-1-git-send-email-andreas.faerber@web.de> References: <1359539035-31698-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Provags-ID: V02:K0:ZDVHWceSMSrek4KgGAyRVRqxAe94msLb7Pt6wkvOsDd kMOhaurARLAIQDp4/mVFXGl90fPouMRagRRhG80UVoZtaEmqC5 R6BaPIs9AB4e0ZGOZzAgvTXbMlqCznv/snZA5+9o72E2Nd/F/k zFDBHnR1yxuwHsgQpDldpLTVloR7+Vs+W54ax2ahY6t4idT/dM l8UrOJjdO10766GaOqXIw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.11 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-ppc@nongnu.org Subject: [Qemu-devel] [PATCH 2/3] prep_pci: Convert to QOM realizefn 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 SysBusDeviceClass' initfn merely calls SysBusDeviceClass::init, so we can already hook up our own realizefn overwriting this behavior. A symmetric unrealizefn is not necessary, knowing that the child's unrealizefn is still no-op, too. Avoids ripping it out again when recursive realization at DeviceState-level is implemented. Signed-off-by: Andreas Färber --- hw/prep_pci.c | 8 ++++---- 1 Datei geändert, 4 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-) diff --git a/hw/prep_pci.c b/hw/prep_pci.c index e1420ca..52ee5d9 100644 --- a/hw/prep_pci.c +++ b/hw/prep_pci.c @@ -111,8 +111,9 @@ static void prep_set_irq(void *opaque, int irq_num, int level) qemu_set_irq(pic[irq_num] , level); } -static int raven_pcihost_init(SysBusDevice *dev) +static void raven_pcihost_realizefn(DeviceState *d, Error **errp) { + SysBusDevice *dev = SYS_BUS_DEVICE(d); PCIHostState *h = PCI_HOST_BRIDGE(dev); PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(dev); MemoryRegion *address_space_mem = get_system_memory(); @@ -141,7 +142,7 @@ static int raven_pcihost_init(SysBusDevice *dev) memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->intack); /* TODO Remove once realize propagates to child devices. */ - return qdev_init(DEVICE(&s->pci_dev)); + object_property_set_bool(OBJECT(&s->pci_dev), true, "realized", errp); } static void raven_pcihost_initfn(Object *obj) @@ -207,10 +208,9 @@ static const TypeInfo raven_info = { static void raven_pcihost_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - k->init = raven_pcihost_init; + dc->realize = raven_pcihost_realizefn; dc->fw_name = "pci"; dc->no_user = 1; }