From patchwork Thu Jan 24 08:34:07 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: 215268 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 CDC202C0084 for ; Thu, 24 Jan 2013 19:34:35 +1100 (EST) Received: from localhost ([::1]:51014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyIGW-00065j-K8 for incoming@patchwork.ozlabs.org; Thu, 24 Jan 2013 03:34:32 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyIGP-00063l-1f for qemu-devel@nongnu.org; Thu, 24 Jan 2013 03:34:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyIGN-0000KE-Ii for qemu-devel@nongnu.org; Thu, 24 Jan 2013 03:34:24 -0500 Received: from mout.web.de ([212.227.17.12]:65478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyIGJ-0000I8-N5; Thu, 24 Jan 2013 03:34:19 -0500 Received: from localhost.localdomain ([84.148.60.98]) by smtp.web.de (mrweb103) with ESMTPSA (Nemesis) id 0MN4Oy-1U4su92tYG-006jJs; Thu, 24 Jan 2013 09:34:18 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2013 09:34:07 +0100 Message-Id: <1359016447-23268-3-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359016447-23268-1-git-send-email-andreas.faerber@web.de> References: <1359016447-23268-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Provags-ID: V02:K0:zM4B39SzSqJGJZiOQy1PqEwH+ObRPZ3cFJ2eN2Em38S UPOM9uhvw5t0u6AA7+NKkhjfeluStDpVfnAb3Qjjww9eALdmo2 5LSZ2iYHO1KuLJP4vT9O5BVmv6RKOZLceBSt0WN6S/VbDtGrPI jhlrlgpAfuAqn3Noa8q1BrVUhhlwnwZJ0wDNMPR+oEFpuyDYRx UEbtJpmreEUBq3DMSnN3w== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.12 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , qemu-ppc@nongnu.org Subject: [Qemu-devel] [PATCH prep for-1.4 v3 2/2] 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; }