From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvUeo-0003Bu-6J for qemu-devel@nongnu.org; Wed, 16 Jan 2013 10:12:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TvUei-000322-5x for qemu-devel@nongnu.org; Wed, 16 Jan 2013 10:12:02 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 16 Jan 2013 16:11:47 +0100 Message-Id: <1358349107-19592-3-git-send-email-afaerber@suse.de> In-Reply-To: <1358349107-19592-1-git-send-email-afaerber@suse.de> References: <1358349107-19592-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH prep for-1.4? v2 2/2] prep_pci: Convert to QOM realizefn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , "open list:PReP" , anthony@codemonkey.ws From: Andreas F=C3=A4rber 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=C3=A4rber --- hw/prep_pci.c | 8 ++++---- 1 Datei ge=C3=A4ndert, 4 Zeilen hinzugef=C3=BCgt(+), 4 Zeilen entfernt(-= ) diff --git a/hw/prep_pci.c b/hw/prep_pci.c index 10196b6..a2bd1c5 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, i= nt level) qemu_set_irq(pic[irq_num] , level); } =20 -static int raven_pcihost_init(SysBusDevice *dev) +static void raven_pcihost_realizefn(DeviceState *d, Error **errp) { + SysBusDevice *dev =3D SYS_BUS_DEVICE(d); PCIHostState *h =3D PCI_HOST_BRIDGE(dev); PREPPCIState *s =3D RAVEN_PCI_HOST_BRIDGE(dev); MemoryRegion *address_space_mem =3D get_system_memory(); @@ -141,7 +142,7 @@ static int raven_pcihost_init(SysBusDevice *dev) memory_region_add_subregion(address_space_mem, 0xbffffff0, &s->intac= k); =20 /* 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= ); } =20 static void raven_pcihost_initfn(Object *obj) @@ -215,10 +216,9 @@ static const TypeInfo raven_info =3D { =20 static void raven_pcihost_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); =20 - k->init =3D raven_pcihost_init; + dc->realize =3D raven_pcihost_realizefn; dc->fw_name =3D "pci"; dc->no_user =3D 1; } --=20 1.7.10.4