diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2017-05-25 21:34:49 +0800 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2017-06-02 05:54:43 +0100 |
commit | 4410b94cce207c6ee93541cae78b38f64a39f5eb (patch) | |
tree | f44b4cb0efb931fb718f6a99749006bda59e55ea /hw/timer/slavio_timer.c | |
parent | c04e34a9823f8d2ff19ed2b9b3128c8b3e498c01 (diff) |
hw/timer: QOM'ify slavio_timer
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>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/timer/slavio_timer.c')
-rw-r--r-- | hw/timer/slavio_timer.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index bfee1f3027..a8cc9c0148 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -373,9 +373,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; @@ -394,14 +395,12 @@ static int slavio_timer_init1(SysBusDevice *dev) size = i == 0 ? SYS_TIMER_SIZE : CPU_TIMER_SIZE; snprintf(timer_name, sizeof(timer_name), "timer-%i", i); - memory_region_init_io(&tc->iomem, OBJECT(s), &slavio_timer_mem_ops, tc, + memory_region_init_io(&tc->iomem, obj, &slavio_timer_mem_ops, tc, timer_name, size); sysbus_init_mmio(dev, &tc->iomem); sysbus_init_irq(dev, &s->cputimer[i].irq); } - - return 0; } static Property slavio_timer_properties[] = { @@ -412,9 +411,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; @@ -424,6 +421,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, }; |