[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 059/173] strongarm: QOM cast cleanup for StrongARMSSP
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 059/173] strongarm: QOM cast cleanup for StrongARMSSPState |
Date: |
Mon, 29 Jul 2013 21:18:36 +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/strongarm.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 61c2b22..82a9492 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -1336,8 +1336,14 @@ static const TypeInfo strongarm_uart_info = {
};
/* Synchronous Serial Ports */
-typedef struct {
- SysBusDevice busdev;
+
+#define TYPE_STRONGARM_SSP "strongarm-ssp"
+#define STRONGARM_SSP(obj) \
+ OBJECT_CHECK(StrongARMSSPState, (obj), TYPE_STRONGARM_SSP)
+
+typedef struct StrongARMSSPState {
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
qemu_irq irq;
SSIBus *bus;
@@ -1519,23 +1525,25 @@ static int strongarm_ssp_post_load(void *opaque, int
version_id)
return 0;
}
-static int strongarm_ssp_init(SysBusDevice *dev)
+static int strongarm_ssp_init(SysBusDevice *sbd)
{
- StrongARMSSPState *s = FROM_SYSBUS(StrongARMSSPState, dev);
+ DeviceState *dev = DEVICE(sbd);
+ StrongARMSSPState *s = STRONGARM_SSP(dev);
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
memory_region_init_io(&s->iomem, OBJECT(s), &strongarm_ssp_ops, s,
"ssp", 0x1000);
- sysbus_init_mmio(dev, &s->iomem);
+ sysbus_init_mmio(sbd, &s->iomem);
- s->bus = ssi_create_bus(&dev->qdev, "ssi");
+ s->bus = ssi_create_bus(dev, "ssi");
return 0;
}
static void strongarm_ssp_reset(DeviceState *dev)
{
- StrongARMSSPState *s = DO_UPCAST(StrongARMSSPState, busdev.qdev, dev);
+ StrongARMSSPState *s = STRONGARM_SSP(dev);
+
s->sssr = 0x03; /* 3 bit data, SPI, disabled */
s->rx_start = 0;
s->rx_level = 0;
@@ -1569,7 +1577,7 @@ static void strongarm_ssp_class_init(ObjectClass *klass,
void *data)
}
static const TypeInfo strongarm_ssp_info = {
- .name = "strongarm-ssp",
+ .name = TYPE_STRONGARM_SSP,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(StrongARMSSPState),
.class_init = strongarm_ssp_class_init,
@@ -1633,7 +1641,7 @@ StrongARMState *sa1110_init(MemoryRegion *sysmem,
qdev_get_gpio_in(s->pic, sa_serial[i].irq));
}
- s->ssp = sysbus_create_varargs("strongarm-ssp", 0x80070000,
+ s->ssp = sysbus_create_varargs(TYPE_STRONGARM_SSP, 0x80070000,
qdev_get_gpio_in(s->pic, SA_PIC_SSP), NULL);
s->ssp_bus = (SSIBus *)qdev_get_child_bus(s->ssp, "ssi");
--
1.8.1.4
- [Qemu-devel] [PULL 050/173] spitz: QOM cast cleanup for SpitzKeyboardState, (continued)
- [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, 2013/07/29
- [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 <=
- [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
- [Qemu-devel] [PULL 066/173] lm32_juart: Relocate and tidy header, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 062/173] escc: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 063/173] exynos4210_uart: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 064/173] grlib_apbuart: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 065/173] imx_serial: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 067/173] lm32_juart: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 068/173] lm32_uart: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 070/173] pl011: Rename pl011_state, Andreas Färber, 2013/07/29