diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2013-11-05 18:16:05 +0800 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-12-24 18:02:18 +0100 |
commit | db0f888848bc5cc578d005d04f4cf7a1105bb758 (patch) | |
tree | 3745d7e3d88231ad49cc9a1ffce7b876fc169a0b /hw/intc/ioapic_common.c | |
parent | f97718584baa6ef919d00067b9787ba7fc5f1a5b (diff) | |
download | hqemu-db0f888848bc5cc578d005d04f4cf7a1105bb758.zip hqemu-db0f888848bc5cc578d005d04f4cf7a1105bb758.tar.gz |
ioapic: QOM'ify ioapic
Convert 'init' function to QOM's 'realize' for ioapic and kvm-ioapic.
Change variable 'ioapic_no' from static to global. Then we can drop
the 'instance_no' function argument.
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/intc/ioapic_common.c')
-rw-r--r-- | hw/intc/ioapic_common.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 4611f7f..4d3d309 100644 --- a/hw/intc/ioapic_common.c +++ b/hw/intc/ioapic_common.c @@ -23,6 +23,14 @@ #include "hw/i386/ioapic_internal.h" #include "hw/sysbus.h" +/* ioapic_no count start from 0 to MAX_IOAPICS, + * remove as static variable from ioapic_common_init. + * now as a global variable, let child to increase the counter + * then we can drop the 'instance_no' argument + * and convert to our QOM's realize function + */ +int ioapic_no; + void ioapic_reset_common(DeviceState *dev) { IOAPICCommonState *s = IOAPIC_COMMON(dev); @@ -61,7 +69,6 @@ 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) { error_setg(errp, "Only %d ioapics allowed", MAX_IOAPICS); @@ -69,7 +76,7 @@ static void ioapic_common_realize(DeviceState *dev, Error **errp) } info = IOAPIC_COMMON_GET_CLASS(s); - info->init(s, ioapic_no); + info->realize(dev, errp); sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->io_memory); ioapic_no++; |