diff options
author | Andreas Färber <andreas.faerber@web.de> | 2013-01-16 15:45:34 +0100 |
---|---|---|
committer | Andreas Färber <andreas.faerber@web.de> | 2013-01-27 23:04:26 +0100 |
commit | 8d5ce2e5643f4055b67ea012d91e812f1e607a83 (patch) | |
tree | 0d4a22f634993e0362ee33e2503d5cf6f5683eae | |
parent | 98aca3c8e8778745cdd0670a792a41314115afa5 (diff) | |
download | qemu-8d5ce2e5643f4055b67ea012d91e812f1e607a83.tar.gz qemu-8d5ce2e5643f4055b67ea012d91e812f1e607a83.tar.bz2 qemu-8d5ce2e5643f4055b67ea012d91e812f1e607a83.zip |
prep_pci: Convert to QOM realizefn
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>
-rw-r--r-- | hw/prep_pci.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/prep_pci.c b/hw/prep_pci.c index e1420cac39..52ee5d9401 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; } |