diff --git a/hw/eccmemctl.c b/hw/eccmemctl.c index 12c386b058..64d4c5e746 100644 --- a/hw/eccmemctl.c +++ b/hw/eccmemctl.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ -#include "sun4m.h" #include "sysbus.h" //#define DEBUG_ECC @@ -276,9 +275,9 @@ static const VMStateDescription vmstate_ecc = { } }; -static void ecc_reset(void *opaque) +static void ecc_reset(DeviceState *d) { - ECCState *s = opaque; + ECCState *s = container_of(d, ECCState, busdev.qdev); if (s->version == ECC_MCC) s->regs[ECC_MER] &= ECC_MER_REU; @@ -310,9 +309,8 @@ static int ecc_init1(SysBusDevice *dev) ecc_diag_mem_write, s); sysbus_init_mmio(dev, ECC_DIAG_SIZE, ecc_io_memory); } - vmstate_register(-1, &vmstate_ecc, s); - qemu_register_reset(ecc_reset, s); - ecc_reset(s); + ecc_reset(&s->busdev.qdev); + return 0; } @@ -320,6 +318,8 @@ static SysBusDeviceInfo ecc_info = { .init = ecc_init1, .qdev.name = "eccmemctl", .qdev.size = sizeof(ECCState), + .qdev.vmsd = &vmstate_ecc, + .qdev.reset = ecc_reset, .qdev.props = (Property[]) { DEFINE_PROP_HEX32("version", ECCState, version, -1), DEFINE_PROP_END_OF_LIST(),