ds1225y: QOM cast cleanup for SysBusNvRamState

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-27 12:50:29 +02:00
parent 14134f0eb5
commit 8c1892cf72

View File

@ -104,14 +104,19 @@ static const VMStateDescription vmstate_nvram = {
} }
}; };
#define TYPE_DS1225Y "ds1225y"
#define DS1225Y(obj) OBJECT_CHECK(SysBusNvRamState, (obj), TYPE_DS1225Y)
typedef struct { typedef struct {
SysBusDevice busdev; SysBusDevice parent_obj;
NvRamState nvram; NvRamState nvram;
} SysBusNvRamState; } SysBusNvRamState;
static int nvram_sysbus_initfn(SysBusDevice *dev) static int nvram_sysbus_initfn(SysBusDevice *dev)
{ {
NvRamState *s = &FROM_SYSBUS(SysBusNvRamState, dev)->nvram; SysBusNvRamState *sys = DS1225Y(dev);
NvRamState *s = &sys->nvram;
FILE *file; FILE *file;
s->contents = g_malloc0(s->chip_size); s->contents = g_malloc0(s->chip_size);
@ -151,7 +156,7 @@ static void nvram_sysbus_class_init(ObjectClass *klass, void *data)
} }
static const TypeInfo nvram_sysbus_info = { static const TypeInfo nvram_sysbus_info = {
.name = "ds1225y", .name = TYPE_DS1225Y,
.parent = TYPE_SYS_BUS_DEVICE, .parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SysBusNvRamState), .instance_size = sizeof(SysBusNvRamState),
.class_init = nvram_sysbus_class_init, .class_init = nvram_sysbus_class_init,