aboutsummaryrefslogtreecommitdiff
path: root/hw/audio/marvell_88w8618.c
diff options
context:
space:
mode:
authorxiaoqiang zhao <zxq_yx_007@163.com>2016-12-31 09:17:19 +0800
committerGerd Hoffmann <kraxel@redhat.com>2017-01-11 09:19:03 +0100
commitc025d0abce5ba2ea0cc6f6695c6703cb449d2b70 (patch)
tree0d925b70c08ec56f623504b6d40edd118a8a9f51 /hw/audio/marvell_88w8618.c
parentb44486dfb9447c88e4b216e730adcc780190852c (diff)
hw/audio: QOM'ify marvell_88w8618.c
split the old SysBus init function into an instance_init and Device realize function Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Message-id: 20161231011720.3965-2-zxq_yx_007@163.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/audio/marvell_88w8618.c')
-rw-r--r--hw/audio/marvell_88w8618.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c
index a6ca1806be..511b004287 100644
--- a/hw/audio/marvell_88w8618.c
+++ b/hw/audio/marvell_88w8618.c
@@ -241,19 +241,23 @@ static const MemoryRegionOps mv88w8618_audio_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int mv88w8618_audio_init(SysBusDevice *dev)
+static void mv88w8618_audio_init(Object *obj)
{
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
mv88w8618_audio_state *s = MV88W8618_AUDIO(dev);
sysbus_init_irq(dev, &s->irq);
- wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s);
-
- memory_region_init_io(&s->iomem, OBJECT(s), &mv88w8618_audio_ops, s,
+ memory_region_init_io(&s->iomem, obj, &mv88w8618_audio_ops, s,
"audio", MP_AUDIO_SIZE);
sysbus_init_mmio(dev, &s->iomem);
+}
- return 0;
+static void mv88w8618_audio_realize(DeviceState *dev, Error **errp)
+{
+ mv88w8618_audio_state *s = MV88W8618_AUDIO(dev);
+
+ wm8750_data_req_set(s->wm, mv88w8618_audio_callback, s);
}
static const VMStateDescription mv88w8618_audio_vmsd = {
@@ -282,9 +286,8 @@ static Property mv88w8618_audio_properties[] = {
static void mv88w8618_audio_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = mv88w8618_audio_init;
+ dc->realize = mv88w8618_audio_realize;
dc->reset = mv88w8618_audio_reset;
dc->vmsd = &mv88w8618_audio_vmsd;
dc->props = mv88w8618_audio_properties;
@@ -296,6 +299,7 @@ static const TypeInfo mv88w8618_audio_info = {
.name = TYPE_MV88W8618_AUDIO,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(mv88w8618_audio_state),
+ .instance_init = mv88w8618_audio_init,
.class_init = mv88w8618_audio_class_init,
};