sparc32_dma: QOM cast cleanup

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2013-07-26 16:55:59 +02:00
parent 358cd7ac59
commit 70cd8d4b75

View File

@ -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,