TYPE_ETRAX_FS_TIMER is a sysbus device, so its DeviceClass::reset() handler is called automatically when its qbus parent is reset. Convert the generic reset to a qdev one, and remove the qemu_register_reset() call.
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- hw/timer/etraxfs_timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index 5379006086f..3cfab3e3284 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -309,9 +309,9 @@ static const MemoryRegionOps timer_ops = { } }; -static void etraxfs_timer_reset(void *opaque) +static void etraxfs_timer_reset(DeviceState *dev) { - ETRAXTimerState *t = opaque; + ETRAXTimerState *t = ETRAX_TIMER(dev); ptimer_transaction_begin(t->ptimer_t0); ptimer_stop(t->ptimer_t0); @@ -343,7 +343,6 @@ static void etraxfs_timer_realize(DeviceState *dev, Error **errp) memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "etraxfs-timer", 0x5c); sysbus_init_mmio(sbd, &t->mmio); - qemu_register_reset(etraxfs_timer_reset, t); } static void etraxfs_timer_class_init(ObjectClass *klass, void *data) @@ -351,6 +350,7 @@ static void etraxfs_timer_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = etraxfs_timer_realize; + dc->reset = etraxfs_timer_reset; } static const TypeInfo etraxfs_timer_info = { -- 2.26.3