diff options
author | Hu Tao <hutao@cn.fujitsu.com> | 2013-07-01 18:18:41 +0800 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-23 00:37:35 +0200 |
commit | f5ba752371b2fc493fdef05cb7e3141161fd1fab (patch) | |
tree | 59f547a5fdbef8917136af59fd7ddd9c65b3cc22 /hw | |
parent | c118d44b6a6977e4019fe1da82f5c333dbbedcfa (diff) | |
download | hqemu-f5ba752371b2fc493fdef05cb7e3141161fd1fab.zip hqemu-f5ba752371b2fc493fdef05cb7e3141161fd1fab.tar.gz |
ioapic: Use QOM realize for ioapic
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
[AF: Tweaked error message]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/intc/ioapic_common.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 5c5bb3c..6b705c1 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -57,23 +57,22 @@ static int ioapic_dispatch_post_load(void *opaque, int version_id) return 0; } -static int ioapic_init_common(SysBusDevice *dev) +static void ioapic_common_realize(DeviceState *dev, Error **errp) { IOAPICCommonState *s = IOAPIC_COMMON(dev); IOAPICCommonClass *info; static int ioapic_no; if (ioapic_no >= MAX_IOAPICS) { - return -1; + error_setg(errp, "Only %d ioapics allowed", MAX_IOAPICS); + return; } info = IOAPIC_COMMON_GET_CLASS(s); info->init(s, ioapic_no); - sysbus_init_mmio(&s->busdev, &s->io_memory); + sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->io_memory); ioapic_no++; - - return 0; } static const VMStateDescription vmstate_ioapic_common = { @@ -95,10 +94,9 @@ static const VMStateDescription vmstate_ioapic_common = { static void ioapic_common_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *sc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - sc->init = ioapic_init_common; + dc->realize = ioapic_common_realize; dc->vmsd = &vmstate_ioapic_common; dc->no_user = 1; } |