@@ -372,9 +372,10 @@ static void slavio_timer_reset(DeviceState *d)
s->cputimer_mode = 0;
}
-static int slavio_timer_init1(SysBusDevice *dev)
+static void slavio_timer_init(Object *obj)
{
- SLAVIO_TIMERState *s = SLAVIO_TIMER(dev);
+ SLAVIO_TIMERState *s = SLAVIO_TIMER(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
QEMUBH *bh;
unsigned int i;
TimerContext *tc;
@@ -399,8 +400,6 @@ static int slavio_timer_init1(SysBusDevice *dev)
sysbus_init_irq(dev, &s->cputimer[i].irq);
}
-
- return 0;
}
static Property slavio_timer_properties[] = {
@@ -411,9 +410,7 @@ static Property slavio_timer_properties[] = {
static void slavio_timer_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = slavio_timer_init1;
dc->reset = slavio_timer_reset;
dc->vmsd = &vmstate_slavio_timer;
dc->props = slavio_timer_properties;
@@ -423,6 +420,7 @@ static const TypeInfo slavio_timer_info = {
.name = TYPE_SLAVIO_TIMER,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SLAVIO_TIMERState),
+ .instance_init = slavio_timer_init,
.class_init = slavio_timer_class_init,
};
rename slavio_timer_init1 to slavio_timer_init and assign it to slavio_timer_info.instance_init, then we drop the SysBusDeviceClass::init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> --- hw/timer/slavio_timer.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)