[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 051/173] stellaris: QOM cast cleanup for gptm_state
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 051/173] stellaris: QOM cast cleanup for gptm_state |
Date: |
Mon, 29 Jul 2013 21:18:28 +0200 |
Introduce a type constant, use QOM casts, rename the parent field and
prepare for QOM realize.
Signed-off-by: Andreas Färber <address@hidden>
---
hw/arm/stellaris.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index a2b6b17..9a7fafb 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -43,8 +43,13 @@ typedef const struct {
/* General purpose timer module. */
+#define TYPE_STELLARIS_GPTM "stellaris-gptm"
+#define STELLARIS_GPTM(obj) \
+ OBJECT_CHECK(gptm_state, (obj), TYPE_STELLARIS_GPTM)
+
typedef struct gptm_state {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
uint32_t config;
uint32_t mode[2];
@@ -300,21 +305,22 @@ static const VMStateDescription vmstate_stellaris_gptm = {
}
};
-static int stellaris_gptm_init(SysBusDevice *dev)
+static int stellaris_gptm_init(SysBusDevice *sbd)
{
- gptm_state *s = FROM_SYSBUS(gptm_state, dev);
+ DeviceState *dev = DEVICE(sbd);
+ gptm_state *s = STELLARIS_GPTM(dev);
- sysbus_init_irq(dev, &s->irq);
- qdev_init_gpio_out(&dev->qdev, &s->trigger, 1);
+ sysbus_init_irq(sbd, &s->irq);
+ qdev_init_gpio_out(dev, &s->trigger, 1);
memory_region_init_io(&s->iomem, OBJECT(s), &gptm_ops, s,
"gptm", 0x1000);
- sysbus_init_mmio(dev, &s->iomem);
+ sysbus_init_mmio(sbd, &s->iomem);
s->opaque[0] = s->opaque[1] = s;
s->timer[0] = qemu_new_timer_ns(vm_clock, gptm_tick, &s->opaque[0]);
s->timer[1] = qemu_new_timer_ns(vm_clock, gptm_tick, &s->opaque[1]);
- vmstate_register(&dev->qdev, -1, &vmstate_stellaris_gptm, s);
+ vmstate_register(dev, -1, &vmstate_stellaris_gptm, s);
return 0;
}
@@ -1215,7 +1221,7 @@ static void stellaris_init(const char *kernel_filename,
const char *cpu_model,
}
for (i = 0; i < 4; i++) {
if (board->dc2 & (0x10000 << i)) {
- dev = sysbus_create_simple("stellaris-gptm",
+ dev = sysbus_create_simple(TYPE_STELLARIS_GPTM,
0x40030000 + i * 0x1000,
pic[timer_irq[i]]);
/* TODO: This is incorrect, but we get away with it because
@@ -1371,7 +1377,7 @@ static void stellaris_gptm_class_init(ObjectClass *klass,
void *data)
}
static const TypeInfo stellaris_gptm_info = {
- .name = "stellaris-gptm",
+ .name = TYPE_STELLARIS_GPTM,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(gptm_state),
.class_init = stellaris_gptm_class_init,
--
1.8.1.4
- [Qemu-devel] [PULL 041/173] musicpal: QOM cast cleanup for mv88w8618_flashcfg, (continued)
- [Qemu-devel] [PULL 041/173] musicpal: QOM cast cleanup for mv88w8618_flashcfg, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 042/173] musicpal: QOM cast cleanup for musicpal_gpio_state, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 043/173] musicpal: QOM cast cleanup for musicpal_key_state, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 044/173] pxa2xx: QOM cast cleanup for PXA2xxSSPState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 045/173] pxa2xx: QOM cast cleanup for PXA2xxRTCState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 046/173] pxa2xx: QOM cast cleanup for PXA2xxI2CState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 047/173] pxa2xx_gpio: QOM cast cleanup for PXA2xxGPIOInfo, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 048/173] pxa2xx_pic: QOM cast cleanup for PXA2xxPICState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 050/173] spitz: QOM cast cleanup for SpitzKeyboardState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 049/173] spitz: QOM cast cleanup for SLNANDState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 051/173] stellaris: QOM cast cleanup for gptm_state,
Andreas Färber <=
- [Qemu-devel] [PULL 052/173] stellaris: QOM cast cleanup for stellaris_i2c_state, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 053/173] stellaris: QOM cast cleanup for stellaris_adc_state, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 054/173] strongarm: QOM cast cleanup for StrongARMPICState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 055/173] strongarm: QOM cast cleanup for StrongARMRTCState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 056/173] strongarm: QOM cast cleanup for StrongARMGPIOInfo, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 057/173] strongarm: QOM cast cleanup for StrongARMPPCInfo, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 058/173] strongarm: QOM cast cleanup for StrongARMUARTState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 059/173] strongarm: QOM cast cleanup for StrongARMSSPState, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 060/173] versatilepb: QOM cast cleanup for vpb_sic_state, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 061/173] cadence_uart: QOM cast cleanup, Andreas Färber, 2013/07/29