提交 f7c5f21e 编写于 作者: M Mao Zhongyi 提交者: Peter Maydell

usb/tusb6010: Convert sysbus init function to realize function

Use DeviceClass rather than SysBusDeviceClass in
tusb6010_class_init().

Cc: kraxel@redhat.com
Signed-off-by: NMao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: NZhang Shengju <zhangshengju@cmss.chinamobile.com>
Message-id: 20181130093852.20739-20-maozhongyi@cmss.chinamobile.com
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 30735a2b
...@@ -808,10 +808,10 @@ static void tusb6010_reset(DeviceState *dev) ...@@ -808,10 +808,10 @@ static void tusb6010_reset(DeviceState *dev)
musb_reset(s->musb); musb_reset(s->musb);
} }
static int tusb6010_init(SysBusDevice *sbd) static void tusb6010_realize(DeviceState *dev, Error **errp)
{ {
DeviceState *dev = DEVICE(sbd);
TUSBState *s = TUSB(dev); TUSBState *s = TUSB(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
s->otg_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_otg_tick, s); 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); s->pwr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_power_tick, s);
...@@ -822,15 +822,13 @@ static int tusb6010_init(SysBusDevice *sbd) ...@@ -822,15 +822,13 @@ static int tusb6010_init(SysBusDevice *sbd)
sysbus_init_irq(sbd, &s->irq); sysbus_init_irq(sbd, &s->irq);
qdev_init_gpio_in(dev, tusb6010_irq, musb_irq_max + 1); qdev_init_gpio_in(dev, tusb6010_irq, musb_irq_max + 1);
s->musb = musb_init(dev, 1); s->musb = musb_init(dev, 1);
return 0;
} }
static void tusb6010_class_init(ObjectClass *klass, void *data) static void tusb6010_class_init(ObjectClass *klass, void *data)
{ {
DeviceClass *dc = DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass);
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
k->init = tusb6010_init; dc->realize = tusb6010_realize;
dc->reset = tusb6010_reset; dc->reset = tusb6010_reset;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册