On 16 February 2016 at 11:10, xiaoqiang zhao <zxq_yx_...@163.com> wrote: > assign tusb6010_init to tusb6010_info.instance_init and drop > the SysBusDeviceClass::init > > Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> > Signed-off-by: xiaoqiang zhao <zxq_yx_...@163.com>
(Again, I didn't review this patch.) > --- > hw/timer/tusb6010.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/hw/timer/tusb6010.c b/hw/timer/tusb6010.c > index 9f6af90..205127c 100644 > --- a/hw/timer/tusb6010.c > +++ b/hw/timer/tusb6010.c > @@ -776,29 +776,27 @@ static void tusb6010_reset(DeviceState *dev) > musb_reset(s->musb); > } > > -static int tusb6010_init(SysBusDevice *sbd) > +static void tusb6010_init(Object *obj) > { > - DeviceState *dev = DEVICE(sbd); > - TUSBState *s = TUSB(dev); > + DeviceState *dev = DEVICE(obj); > + TUSBState *s = TUSB(obj); > + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); > > s->otg_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_otg_tick, s); > s->pwr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_power_tick, s); > - memory_region_init_io(&s->iomem[1], OBJECT(s), &tusb_async_ops, s, > + memory_region_init_io(&s->iomem[1], obj, &tusb_async_ops, s, > "tusb-async", UINT32_MAX); > sysbus_init_mmio(sbd, &s->iomem[0]); > sysbus_init_mmio(sbd, &s->iomem[1]); > sysbus_init_irq(sbd, &s->irq); > qdev_init_gpio_in(dev, tusb6010_irq, musb_irq_max + 1); > s->musb = musb_init(dev, 1); > - return 0; > } > > static void tusb6010_class_init(ObjectClass *klass, void *data) > { > DeviceClass *dc = DEVICE_CLASS(klass); > - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); > > - k->init = tusb6010_init; > dc->reset = tusb6010_reset; > } > > @@ -806,6 +804,7 @@ static const TypeInfo tusb6010_info = { > .name = TYPE_TUSB6010, > .parent = TYPE_SYS_BUS_DEVICE, > .instance_size = sizeof(TUSBState), > + .instance_init = tusb6010_init, > .class_init = tusb6010_class_init, > }; This patch seems to break "make check": TEST: tests/device-introspect-test... (pid=6070) /arm/device/introspect/list: OK /arm/device/introspect/none: OK /arm/device/introspect/abstract: OK /arm/device/introspect/concrete: ** ERROR:/home/petmay01/linaro/qemu-from-laptop/qemu/qom/object.c:1576:object_get_canonical_path_component: assertion failed: (obj->parent != NULL) Broken pipe FAIL GTester: last random seed: R02S57c9475befd55374bcf61f6f190cd8ad (pid=6093) FAIL: tests/device-introspect-test thanks -- PMM