Message ID | 20170429104937.31341-4-zxq_yx_007@163.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 04/29/2017 07:49 AM, xiaoqiang zhao wrote: > Drop the old SysBus init function and use instance_init > > Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > --- > hw/dma/sun4m_iommu.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/hw/dma/sun4m_iommu.c b/hw/dma/sun4m_iommu.c > index b3cbc54c23..335ef63cbc 100644 > --- a/hw/dma/sun4m_iommu.c > +++ b/hw/dma/sun4m_iommu.c > @@ -349,17 +349,16 @@ static void iommu_reset(DeviceState *d) > s->regs[IOMMU_MASK_ID] = IOMMU_TS_MASK; > } > > -static int iommu_init1(SysBusDevice *dev) > +static void iommu_init(Object *obj) > { > - IOMMUState *s = SUN4M_IOMMU(dev); > + IOMMUState *s = SUN4M_IOMMU(obj); > + SysBusDevice *dev = SYS_BUS_DEVICE(obj); > > sysbus_init_irq(dev, &s->irq); > > - memory_region_init_io(&s->iomem, OBJECT(s), &iommu_mem_ops, s, "iommu", > + memory_region_init_io(&s->iomem, obj, &iommu_mem_ops, s, "iommu", > IOMMU_NREGS * sizeof(uint32_t)); > sysbus_init_mmio(dev, &s->iomem); > - > - return 0; > } > > static Property iommu_properties[] = { > @@ -370,9 +369,7 @@ static Property iommu_properties[] = { > static void iommu_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = iommu_init1; > dc->reset = iommu_reset; > dc->vmsd = &vmstate_iommu; > dc->props = iommu_properties; > @@ -382,6 +379,7 @@ static const TypeInfo iommu_info = { > .name = TYPE_SUN4M_IOMMU, > .parent = TYPE_SYS_BUS_DEVICE, > .instance_size = sizeof(IOMMUState), > + .instance_init = iommu_init, > .class_init = iommu_class_init, > }; > >
diff --git a/hw/dma/sun4m_iommu.c b/hw/dma/sun4m_iommu.c index b3cbc54c23..335ef63cbc 100644 --- a/hw/dma/sun4m_iommu.c +++ b/hw/dma/sun4m_iommu.c @@ -349,17 +349,16 @@ static void iommu_reset(DeviceState *d) s->regs[IOMMU_MASK_ID] = IOMMU_TS_MASK; } -static int iommu_init1(SysBusDevice *dev) +static void iommu_init(Object *obj) { - IOMMUState *s = SUN4M_IOMMU(dev); + IOMMUState *s = SUN4M_IOMMU(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); sysbus_init_irq(dev, &s->irq); - memory_region_init_io(&s->iomem, OBJECT(s), &iommu_mem_ops, s, "iommu", + memory_region_init_io(&s->iomem, obj, &iommu_mem_ops, s, "iommu", IOMMU_NREGS * sizeof(uint32_t)); sysbus_init_mmio(dev, &s->iomem); - - return 0; } static Property iommu_properties[] = { @@ -370,9 +369,7 @@ static Property iommu_properties[] = { static void iommu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = iommu_init1; dc->reset = iommu_reset; dc->vmsd = &vmstate_iommu; dc->props = iommu_properties; @@ -382,6 +379,7 @@ static const TypeInfo iommu_info = { .name = TYPE_SUN4M_IOMMU, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(IOMMUState), + .instance_init = iommu_init, .class_init = iommu_class_init, };
Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> --- hw/dma/sun4m_iommu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)