diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2016-05-06 18:59:34 +0800 |
---|---|---|
committer | Michael Walle <michael@walle.cc> | 2016-06-20 18:11:59 +0200 |
commit | 165b244b98923ad94898a693f08d77423176080c (patch) | |
tree | eda67418b72f63d6821297345e4a9f75c4751aa8 /hw/display | |
parent | cf79c64d582c0d75da0b0a540840e2931f647f01 (diff) |
hw/display: QOM'ify milkymist-vgafb.c
* Drop the old SysBus init function and use instance_init
* Move graphic_console_init into realize stage
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Michael Walle <michael@walle.cc>
Tested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Michael Walle <michael@walle.cc>
Diffstat (limited to 'hw/display')
-rw-r--r-- | hw/display/milkymist-vgafb.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c index 19ca256479..39e16d6c8f 100644 --- a/hw/display/milkymist-vgafb.c +++ b/hw/display/milkymist-vgafb.c @@ -292,17 +292,21 @@ static const GraphicHwOps vgafb_ops = { .gfx_update = vgafb_update_display, }; -static int milkymist_vgafb_init(SysBusDevice *dev) +static void milkymist_vgafb_init(Object *obj) { - MilkymistVgafbState *s = MILKYMIST_VGAFB(dev); + MilkymistVgafbState *s = MILKYMIST_VGAFB(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); memory_region_init_io(&s->regs_region, OBJECT(s), &vgafb_mmio_ops, s, "milkymist-vgafb", R_MAX * 4); sysbus_init_mmio(dev, &s->regs_region); +} - s->con = graphic_console_init(DEVICE(dev), 0, &vgafb_ops, s); +static void milkymist_vgafb_realize(DeviceState *dev, Error **errp) +{ + MilkymistVgafbState *s = MILKYMIST_VGAFB(dev); - return 0; + s->con = graphic_console_init(dev, 0, &vgafb_ops, s); } static int vgafb_post_load(void *opaque, int version_id) @@ -331,18 +335,18 @@ static Property milkymist_vgafb_properties[] = { static void milkymist_vgafb_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = milkymist_vgafb_init; dc->reset = milkymist_vgafb_reset; dc->vmsd = &vmstate_milkymist_vgafb; dc->props = milkymist_vgafb_properties; + dc->realize = milkymist_vgafb_realize; } static const TypeInfo milkymist_vgafb_info = { .name = TYPE_MILKYMIST_VGAFB, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MilkymistVgafbState), + .instance_init = milkymist_vgafb_init, .class_init = milkymist_vgafb_class_init, }; |