From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, "Andreas Färber" <andreas.faerber@web.de>,
"open list:PReP" <qemu-ppc@nongnu.org>,
anthony@codemonkey.ws
Subject: [Qemu-devel] [PATCH prep for-1.4? v2 2/2] prep_pci: Convert to QOM realizefn
Date: Wed, 16 Jan 2013 16:11:47 +0100 [thread overview]
Message-ID: <1358349107-19592-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1358349107-19592-1-git-send-email-afaerber@suse.de>
From: Andreas Färber <andreas.faerber@web.de>
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 <andreas.faerber@web.de>
---
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 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, 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)
@@ -215,10 +216,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;
}
--
1.7.10.4
prev parent reply other threads:[~2013-01-16 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-16 15:11 [Qemu-devel] [PATCH prep for-1.4? v2 0/2] prep_pci: Prepare for QOM realize Andreas Färber
2013-01-16 15:11 ` [Qemu-devel] [PATCH prep for-1.4? v2 1/2] prep_pci: Create PCIBus and PCIDevice in-place Andreas Färber
2013-01-16 15:11 ` Andreas Färber [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358349107-19592-3-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=andreas.faerber@web.de \
--cc=anthony@codemonkey.ws \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).