On 22 February 2016 at 09:11, xiaoqiang zhao <zxq_yx_...@163.com> wrote: > assign DeviceClass::vmsd instead of using vmstate_register function > > Signed-off-by: xiaoqiang zhao <zxq_yx_...@163.com> > --- > hw/timer/m48t59.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c > index 3c683aa..b0cf79d 100644 > --- a/hw/timer/m48t59.c > +++ b/hw/timer/m48t59.c > @@ -742,8 +742,6 @@ static void m48t59_realize_common(M48t59State *s, Error > **errp) > s->wd_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &watchdog_cb, s); > } > qemu_get_timedate(&s->alarm, 0); > - > - vmstate_register(NULL, -1, &vmstate_m48t59, s); > } > > static void m48t59_isa_realize(DeviceState *dev, Error **errp) > @@ -822,6 +820,7 @@ static void m48txx_isa_class_init(ObjectClass *klass, > void *data) > dc->realize = m48t59_isa_realize; > dc->reset = m48t59_reset_isa; > dc->props = m48t59_isa_properties; > + dc->vmsd = &vmstate_m48t59; > nc->read = m48txx_isa_read; > nc->write = m48txx_isa_write; > nc->toggle_lock = m48txx_isa_toggle_lock; > @@ -866,6 +865,7 @@ static void m48txx_sysbus_class_init(ObjectClass *klass, > void *data) > dc->realize = m48t59_realize; > dc->reset = m48t59_reset_sysbus; > dc->props = m48t59_sysbus_properties; > + dc->vmsd = &vmstate_m48t59; > nc->read = m48txx_sysbus_read; > nc->write = m48txx_sysbus_write; > nc->toggle_lock = m48txx_sysbus_toggle_lock; > -- > 2.1.4 >
Just noticed this won't work as it is -- the vmstate struct is for the M48t59State*, but the ISA and Sysbus wrappers have their own structs which are what the dc->vmsd will be wanting to operate on. You'd need extra VMState structs I think and somebody who knows migration better than me to say whether that is a migration compat break. thanks -- PMM