diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-25 00:48:23 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:02 +0200 |
commit | 56299135f5c32a8b606e4b62af9200a3cee65985 (patch) | |
tree | 64a8bb9149a6ff512232f8e1b92805b4fbae2a37 /hw/display | |
parent | 66c2de562f504895eeb407a04dddd4c76ab70c50 (diff) | |
download | qemu-56299135f5c32a8b606e4b62af9200a3cee65985.tar.gz qemu-56299135f5c32a8b606e4b62af9200a3cee65985.tar.bz2 qemu-56299135f5c32a8b606e4b62af9200a3cee65985.zip |
milkymist-tmu2: QOM cast cleanup
Introduce a type constant, use QOM casts and rename the parent field.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/display')
-rw-r--r-- | hw/display/milkymist-tmu2.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index efda0824fe..b2a5fba0ff 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -75,8 +75,13 @@ struct vertex { int y; } QEMU_PACKED; +#define TYPE_MILKYMIST_TMU2 "milkymist-tmu2" +#define MILKYMIST_TMU2(obj) \ + OBJECT_CHECK(MilkymistTMU2State, (obj), TYPE_MILKYMIST_TMU2) + struct MilkymistTMU2State { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion regs_region; CharDriverState *chr; qemu_irq irq; @@ -429,7 +434,7 @@ static const MemoryRegionOps tmu2_mmio_ops = { static void milkymist_tmu2_reset(DeviceState *d) { - MilkymistTMU2State *s = container_of(d, MilkymistTMU2State, busdev.qdev); + MilkymistTMU2State *s = MILKYMIST_TMU2(d); int i; for (i = 0; i < R_MAX; i++) { @@ -439,7 +444,7 @@ static void milkymist_tmu2_reset(DeviceState *d) static int milkymist_tmu2_init(SysBusDevice *dev) { - MilkymistTMU2State *s = FROM_SYSBUS(typeof(*s), dev); + MilkymistTMU2State *s = MILKYMIST_TMU2(dev); if (tmu2_glx_init(s)) { return 1; @@ -476,7 +481,7 @@ static void milkymist_tmu2_class_init(ObjectClass *klass, void *data) } static const TypeInfo milkymist_tmu2_info = { - .name = "milkymist-tmu2", + .name = TYPE_MILKYMIST_TMU2, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistTMU2State), .class_init = milkymist_tmu2_class_init, |