diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-24 01:27:32 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 21:06:26 +0200 |
commit | 4adc8541d970f5a52a8cb05f893f4afeec255d5b (patch) | |
tree | 04ec31317774195e59ed0649b5cd4d05f5af6b00 /hw/arm/musicpal.c | |
parent | c7bd0fd945c3f7f1d93a226dbe89a2ccf0503a58 (diff) |
musicpal: QOM cast cleanup for mv88w8618_pit_state
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/arm/musicpal.c')
-rw-r--r-- | hw/arm/musicpal.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index d6f593bcba..b2a28d926f 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -816,8 +816,15 @@ typedef struct mv88w8618_timer_state { qemu_irq irq; } mv88w8618_timer_state; +#define TYPE_MV88W8618_PIT "mv88w8618_pit" +#define MV88W8618_PIT(obj) \ + OBJECT_CHECK(mv88w8618_pit_state, (obj), TYPE_MV88W8618_PIT) + typedef struct mv88w8618_pit_state { - SysBusDevice busdev; + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + MemoryRegion iomem; mv88w8618_timer_state timer[4]; } mv88w8618_pit_state; @@ -899,8 +906,7 @@ static void mv88w8618_pit_write(void *opaque, hwaddr offset, static void mv88w8618_pit_reset(DeviceState *d) { - mv88w8618_pit_state *s = FROM_SYSBUS(mv88w8618_pit_state, - SYS_BUS_DEVICE(d)); + mv88w8618_pit_state *s = MV88W8618_PIT(d); int i; for (i = 0; i < 4; i++) { @@ -917,7 +923,7 @@ static const MemoryRegionOps mv88w8618_pit_ops = { static int mv88w8618_pit_init(SysBusDevice *dev) { - mv88w8618_pit_state *s = FROM_SYSBUS(mv88w8618_pit_state, dev); + mv88w8618_pit_state *s = MV88W8618_PIT(dev); int i; /* Letting them all run at 1 MHz is likely just a pragmatic @@ -967,7 +973,7 @@ static void mv88w8618_pit_class_init(ObjectClass *klass, void *data) } static const TypeInfo mv88w8618_pit_info = { - .name = "mv88w8618_pit", + .name = TYPE_MV88W8618_PIT, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(mv88w8618_pit_state), .class_init = mv88w8618_pit_class_init, @@ -1598,7 +1604,7 @@ static void musicpal_init(QEMUMachineInitArgs *args) for (i = 0; i < 32; i++) { pic[i] = qdev_get_gpio_in(dev, i); } - sysbus_create_varargs("mv88w8618_pit", MP_PIT_BASE, pic[MP_TIMER1_IRQ], + sysbus_create_varargs(TYPE_MV88W8618_PIT, MP_PIT_BASE, pic[MP_TIMER1_IRQ], pic[MP_TIMER2_IRQ], pic[MP_TIMER3_IRQ], pic[MP_TIMER4_IRQ], NULL); |