[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 077/173] sparc32_dma: QOM cast cleanup
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 077/173] sparc32_dma: QOM cast cleanup |
Date: |
Mon, 29 Jul 2013 21:18:54 +0200 |
Signed-off-by: Andreas Färber <address@hidden>
---
hw/dma/sparc32_dma.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index be6275f..2a92ffb 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -60,10 +60,14 @@
/* XXX SCSI and ethernet should have different read-only bit masks */
#define DMA_CSR_RO_MASK 0xfe000007
+#define TYPE_SPARC32_DMA "sparc32_dma"
+#define SPARC32_DMA(obj) OBJECT_CHECK(DMAState, (obj), TYPE_SPARC32_DMA)
+
typedef struct DMAState DMAState;
struct DMAState {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
uint32_t dmaregs[DMA_REGS];
qemu_irq irq;
@@ -249,7 +253,7 @@ static const MemoryRegionOps dma_mem_ops = {
static void dma_reset(DeviceState *d)
{
- DMAState *s = container_of(d, DMAState, busdev.qdev);
+ DMAState *s = SPARC32_DMA(d);
memset(s->dmaregs, 0, DMA_SIZE);
s->dmaregs[0] = DMA_VER;
@@ -266,20 +270,21 @@ static const VMStateDescription vmstate_dma = {
}
};
-static int sparc32_dma_init1(SysBusDevice *dev)
+static int sparc32_dma_init1(SysBusDevice *sbd)
{
- DMAState *s = FROM_SYSBUS(DMAState, dev);
+ DeviceState *dev = DEVICE(sbd);
+ DMAState *s = SPARC32_DMA(dev);
int reg_size;
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
reg_size = s->is_ledma ? DMA_ETH_SIZE : DMA_SIZE;
memory_region_init_io(&s->iomem, OBJECT(s), &dma_mem_ops, s,
"dma", reg_size);
- sysbus_init_mmio(dev, &s->iomem);
+ sysbus_init_mmio(sbd, &s->iomem);
- qdev_init_gpio_in(&dev->qdev, dma_set_irq, 1);
- qdev_init_gpio_out(&dev->qdev, s->gpio, 2);
+ qdev_init_gpio_in(dev, dma_set_irq, 1);
+ qdev_init_gpio_out(dev, s->gpio, 2);
return 0;
}
@@ -302,7 +307,7 @@ static void sparc32_dma_class_init(ObjectClass *klass, void
*data)
}
static const TypeInfo sparc32_dma_info = {
- .name = "sparc32_dma",
+ .name = TYPE_SPARC32_DMA,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(DMAState),
.class_init = sparc32_dma_class_init,
--
1.8.1.4
- [Qemu-devel] [PULL 067/173] lm32_juart: QOM cast cleanup, (continued)
- [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
- [Qemu-devel] [PULL 069/173] milkymist-uart: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 071/173] pl011: QOM'ify pl011 and pl011_luminary, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 072/173] empty_slot: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 073/173] pl080: Rename pl080_state to PL080State, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 074/173] pl080: QOM'ify pl080 and pl081, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 075/173] puv3_dma: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 076/173] pxa2xx_dma: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 077/173] sparc32_dma: QOM cast cleanup,
Andreas Färber <=
- [Qemu-devel] [PULL 079/173] omap_gpio: QOM cast cleanup for omap_gpif_s, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 080/173] omap_gpio: QOM cast cleanup for omap2_gpif_s, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 078/173] sun4m_iommu: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 081/173] pl061: Rename pl061_state to PL061State, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 083/173] puv3_gpio: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 085/173] bitbang_i2c: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 082/173] pl061: QOM'ify pl061 and pl061_luminary, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 086/173] omap_i2c: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 084/173] gpio/zaurus: QOM cast cleanup, Andreas Färber, 2013/07/29
- [Qemu-devel] [PULL 087/173] versatile_i2c: QOM cast cleanup, Andreas Färber, 2013/07/29