Message ID | 1457334350-5675-3-git-send-email-zxq_yx_007@163.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Mar 6, 2016 at 11:05 PM, xiaoqiang zhao <zxq_yx_007@163.com> wrote: > Drop the use of old SysBus init function and use instance_init > > Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> (just this one as I have done some highbank work recently - I cant do the whole series). Regards, Peter > --- > hw/arm/highbank.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c > index e25cf5e..8f38dff 100644 > --- a/hw/arm/highbank.c > +++ b/hw/arm/highbank.c > @@ -167,23 +167,20 @@ static void highbank_regs_reset(DeviceState *dev) > s->regs[0x43] = 0x05F40121; > } > > -static int highbank_regs_init(SysBusDevice *dev) > +static void highbank_regs_init(Object *obj) > { > - HighbankRegsState *s = HIGHBANK_REGISTERS(dev); > + HighbankRegsState *s = HIGHBANK_REGISTERS(obj); > + SysBusDevice *dev = SYS_BUS_DEVICE(obj); > > - memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs, > + memory_region_init_io(&s->iomem, obj, &hb_mem_ops, s->regs, > "highbank_regs", 0x1000); > sysbus_init_mmio(dev, &s->iomem); > - > - return 0; > } > > static void highbank_regs_class_init(ObjectClass *klass, void *data) > { > - SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass); > DeviceClass *dc = DEVICE_CLASS(klass); > > - sbc->init = highbank_regs_init; > dc->desc = "Calxeda Highbank registers"; > dc->vmsd = &vmstate_highbank_regs; > dc->reset = highbank_regs_reset; > @@ -193,6 +190,7 @@ static const TypeInfo highbank_regs_info = { > .name = TYPE_HIGHBANK_REGISTERS, > .parent = TYPE_SYS_BUS_DEVICE, > .instance_size = sizeof(HighbankRegsState), > + .instance_init = highbank_regs_init, > .class_init = highbank_regs_class_init, > }; > > -- > 2.1.4 > > >
? 2016?03?08? 01:40, Peter Crosthwaite ??: > On Sun, Mar 6, 2016 at 11:05 PM, xiaoqiang zhao <zxq_yx_007@163.com> wrote: >> Drop the use of old SysBus init function and use instance_init >> >> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> > Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> > > (just this one as I have done some highbank work recently - I cant do > the whole series). > > Regards, > Peter > >> --- >> hw/arm/highbank.c | 12 +++++------- >> 1 file changed, 5 insertions(+), 7 deletions(-) >> >> diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c >> index e25cf5e..8f38dff 100644 >> --- a/hw/arm/highbank.c >> +++ b/hw/arm/highbank.c >> @@ -167,23 +167,20 @@ static void highbank_regs_reset(DeviceState *dev) >> s->regs[0x43] = 0x05F40121; >> } >> >> -static int highbank_regs_init(SysBusDevice *dev) >> +static void highbank_regs_init(Object *obj) >> { >> - HighbankRegsState *s = HIGHBANK_REGISTERS(dev); >> + HighbankRegsState *s = HIGHBANK_REGISTERS(obj); >> + SysBusDevice *dev = SYS_BUS_DEVICE(obj); >> >> - memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs, >> + memory_region_init_io(&s->iomem, obj, &hb_mem_ops, s->regs, >> "highbank_regs", 0x1000); >> sysbus_init_mmio(dev, &s->iomem); >> - >> - return 0; >> } >> >> static void highbank_regs_class_init(ObjectClass *klass, void *data) >> { >> - SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass); >> DeviceClass *dc = DEVICE_CLASS(klass); >> >> - sbc->init = highbank_regs_init; >> dc->desc = "Calxeda Highbank registers"; >> dc->vmsd = &vmstate_highbank_regs; >> dc->reset = highbank_regs_reset; >> @@ -193,6 +190,7 @@ static const TypeInfo highbank_regs_info = { >> .name = TYPE_HIGHBANK_REGISTERS, >> .parent = TYPE_SYS_BUS_DEVICE, >> .instance_size = sizeof(HighbankRegsState), >> + .instance_init = highbank_regs_init, >> .class_init = highbank_regs_class_init, >> }; >> >> -- >> 2.1.4 >> >> >> Thanks for your reply, Peter !
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index e25cf5e..8f38dff 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -167,23 +167,20 @@ static void highbank_regs_reset(DeviceState *dev) s->regs[0x43] = 0x05F40121; } -static int highbank_regs_init(SysBusDevice *dev) +static void highbank_regs_init(Object *obj) { - HighbankRegsState *s = HIGHBANK_REGISTERS(dev); + HighbankRegsState *s = HIGHBANK_REGISTERS(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); - memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs, + memory_region_init_io(&s->iomem, obj, &hb_mem_ops, s->regs, "highbank_regs", 0x1000); sysbus_init_mmio(dev, &s->iomem); - - return 0; } static void highbank_regs_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - sbc->init = highbank_regs_init; dc->desc = "Calxeda Highbank registers"; dc->vmsd = &vmstate_highbank_regs; dc->reset = highbank_regs_reset; @@ -193,6 +190,7 @@ static const TypeInfo highbank_regs_info = { .name = TYPE_HIGHBANK_REGISTERS, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(HighbankRegsState), + .instance_init = highbank_regs_init, .class_init = highbank_regs_class_init, };
Drop the use of old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> --- hw/arm/highbank.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)