diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-26 22:27:57 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:58 +0200 |
commit | aee31f7b4b7e23cfcdab604b6edc5e7df8d5c32f (patch) | |
tree | a50246e13fe0cc2f283e091d9ca5cd48eb889b5d /hw/misc | |
parent | 829617a97cd4316872465db6b28d304e49f45f05 (diff) |
milkymist-pfpu: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/misc')
-rw-r--r-- | hw/misc/milkymist-pfpu.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c index 2b64ee77d8..b3b2143d51 100644 --- a/hw/misc/milkymist-pfpu.c +++ b/hw/misc/milkymist-pfpu.c @@ -116,8 +116,13 @@ static const char *opcode_to_str[] = { }; #endif +#define TYPE_MILKYMIST_PFPU "milkymist-pfpu" +#define MILKYMIST_PFPU(obj) \ + OBJECT_CHECK(MilkymistPFPUState, (obj), TYPE_MILKYMIST_PFPU) + struct MilkymistPFPUState { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion regs_region; CharDriverState *chr; qemu_irq irq; @@ -473,7 +478,7 @@ static const MemoryRegionOps pfpu_mmio_ops = { static void milkymist_pfpu_reset(DeviceState *d) { - MilkymistPFPUState *s = container_of(d, MilkymistPFPUState, busdev.qdev); + MilkymistPFPUState *s = MILKYMIST_PFPU(d); int i; for (i = 0; i < R_MAX; i++) { @@ -493,7 +498,7 @@ static void milkymist_pfpu_reset(DeviceState *d) static int milkymist_pfpu_init(SysBusDevice *dev) { - MilkymistPFPUState *s = FROM_SYSBUS(typeof(*s), dev); + MilkymistPFPUState *s = MILKYMIST_PFPU(dev); sysbus_init_irq(dev, &s->irq); @@ -530,7 +535,7 @@ static void milkymist_pfpu_class_init(ObjectClass *klass, void *data) } static const TypeInfo milkymist_pfpu_info = { - .name = "milkymist-pfpu", + .name = TYPE_MILKYMIST_PFPU, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistPFPUState), .class_init = milkymist_pfpu_class_init, |