Message ID | 2c400ea6690e0951a4aeae6f06a78081788d3a25.1372673778.git.hutao@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
Am 01.07.2013 12:18, schrieb Hu Tao: > Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> > --- > hw/intc/ioapic_common.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c > index 5c5bb3c..5dc1f1e 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, "invalid ioapic number: %d", ioapic_no); Since the ioapic number was not chosen by the user, I have changed this similar to the preceding error message, referring to the maximum instead. Andreas > + 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; > } >
diff --git a/hw/intc/ioapic_common.c b/hw/intc/ioapic_common.c index 5c5bb3c..5dc1f1e 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, "invalid ioapic number: %d", ioapic_no); + 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; }
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- hw/intc/ioapic_common.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)