aboutsummaryrefslogtreecommitdiff
path: root/hw/dma
diff options
context:
space:
mode:
authorxiaoqiang zhao <zxq_yx_007@163.com>2017-05-25 21:34:45 +0800
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-06-02 05:54:43 +0100
commit8c612079e08f47965c5e567a114c24b7970fd639 (patch)
tree343d3398412964775c0be26a1aaca8599025b0ca /hw/dma
parentb229a5765bc0973102ca9908ecc95bff4918f0c1 (diff)
downloadqemu-8c612079e08f47965c5e567a114c24b7970fd639.zip
qemu-8c612079e08f47965c5e567a114c24b7970fd639.tar.gz
qemu-8c612079e08f47965c5e567a114c24b7970fd639.tar.bz2
hw/dma: QOM'ify sparc32_dma.c
Drop the old SysBus init function and use instance_init and an realize function Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/dma')
-rw-r--r--hw/dma/sparc32_dma.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index 9c6bdc6..eb491b5 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -270,23 +270,28 @@ static const VMStateDescription vmstate_dma = {
}
};
-static int sparc32_dma_init1(SysBusDevice *sbd)
+static void sparc32_dma_init(Object *obj)
{
- DeviceState *dev = DEVICE(sbd);
- DMAState *s = SPARC32_DMA(dev);
- int reg_size;
+ DeviceState *dev = DEVICE(obj);
+ DMAState *s = SPARC32_DMA(obj);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
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(sbd, &s->iomem);
qdev_init_gpio_in(dev, dma_set_irq, 1);
qdev_init_gpio_out(dev, s->gpio, 2);
+}
- return 0;
+static void sparc32_dma_realize(DeviceState *dev, Error **errp)
+{
+ DMAState *s = SPARC32_DMA(dev);
+ int reg_size;
+
+ reg_size = s->is_ledma ? DMA_ETH_SIZE : DMA_SIZE;
+ memory_region_init_io(&s->iomem, OBJECT(dev), &dma_mem_ops, s,
+ "dma", reg_size);
}
static Property sparc32_dma_properties[] = {
@@ -298,12 +303,11 @@ static Property sparc32_dma_properties[] = {
static void sparc32_dma_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = sparc32_dma_init1;
dc->reset = dma_reset;
dc->vmsd = &vmstate_dma;
dc->props = sparc32_dma_properties;
+ dc->realize = sparc32_dma_realize;
/* Reason: pointer property "iommu_opaque" */
dc->user_creatable = false;
}
@@ -312,6 +316,7 @@ static const TypeInfo sparc32_dma_info = {
.name = TYPE_SPARC32_DMA,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(DMAState),
+ .instance_init = sparc32_dma_init,
.class_init = sparc32_dma_class_init,
};