diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-27 15:01:49 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:07:01 +0200 |
commit | 29d1ffc3d8ccbc72dfe1e136a69235901d328d86 (patch) | |
tree | 571598984022a8bf3ae56751139ead86c8f4ac43 /hw/timer | |
parent | fe54d857056b3cf143fe5aebcf56b7c638d62bc0 (diff) | |
download | qemu-29d1ffc3d8ccbc72dfe1e136a69235901d328d86.zip qemu-29d1ffc3d8ccbc72dfe1e136a69235901d328d86.tar.gz qemu-29d1ffc3d8ccbc72dfe1e136a69235901d328d86.tar.bz2 |
m48t59: QOM cast cleanup for M48t59SysBusState
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/timer')
-rw-r--r-- | hw/timer/m48t59.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index be3490b..0cc9e5b 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -83,8 +83,12 @@ typedef struct M48t59ISAState { MemoryRegion io; } M48t59ISAState; +#define SYSBUS_M48T59(obj) \ + OBJECT_CHECK(M48t59SysBusState, (obj), TYPE_SYSBUS_M48T59) + typedef struct M48t59SysBusState { - SysBusDevice busdev; + SysBusDevice parent_obj; + M48t59State state; MemoryRegion io; } M48t59SysBusState; @@ -621,7 +625,7 @@ static void m48t59_reset_isa(DeviceState *d) static void m48t59_reset_sysbus(DeviceState *d) { - M48t59SysBusState *sys = container_of(d, M48t59SysBusState, busdev.qdev); + M48t59SysBusState *sys = SYSBUS_M48T59(d); M48t59State *NVRAM = &sys->state; m48t59_reset_common(NVRAM); @@ -646,13 +650,13 @@ M48t59State *m48t59_init(qemu_irq IRQ, hwaddr mem_base, M48t59SysBusState *d; M48t59State *state; - dev = qdev_create(NULL, "m48t59"); + dev = qdev_create(NULL, TYPE_SYSBUS_M48T59); qdev_prop_set_uint32(dev, "model", model); qdev_prop_set_uint32(dev, "size", size); qdev_prop_set_uint32(dev, "io_base", io_base); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); - d = FROM_SYSBUS(M48t59SysBusState, s); + d = SYSBUS_M48T59(dev); state = &d->state; sysbus_connect_irq(s, 0, IRQ); memory_region_init_io(&d->io, OBJECT(d), &m48t59_io_ops, state, @@ -716,7 +720,7 @@ static void m48t59_isa_realize(DeviceState *dev, Error **errp) static int m48t59_init1(SysBusDevice *dev) { - M48t59SysBusState *d = FROM_SYSBUS(M48t59SysBusState, dev); + M48t59SysBusState *d = SYSBUS_M48T59(dev); M48t59State *s = &d->state; Error *err = NULL; @@ -776,7 +780,7 @@ static void m48t59_class_init(ObjectClass *klass, void *data) } static const TypeInfo m48t59_info = { - .name = "m48t59", + .name = TYPE_SYSBUS_M48T59, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(M48t59SysBusState), .class_init = m48t59_class_init, |