aboutsummaryrefslogtreecommitdiff
path: root/hw/audio/sb16.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/audio/sb16.c')
-rw-r--r--hw/audio/sb16.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index 6ddc0ac258..e697bc1498 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -1356,12 +1356,19 @@ static const MemoryRegionPortio sb16_ioport_list[] = {
};
-static int sb16_initfn (ISADevice *dev)
+static void sb16_initfn (Object *obj)
{
- SB16State *s = SB16 (dev);
+ SB16State *s = SB16 (obj);
s->cmd = -1;
- isa_init_irq (dev, &s->pic, s->irq);
+}
+
+static void sb16_realizefn (DeviceState *dev, Error **errp)
+{
+ ISADevice *isadev = ISA_DEVICE (dev);
+ SB16State *s = SB16 (dev);
+
+ isa_init_irq (isadev, &s->pic, s->irq);
s->mixer_regs[0x80] = magic_of_irq (s->irq);
s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
@@ -1376,14 +1383,13 @@ static int sb16_initfn (ISADevice *dev)
dolog ("warning: Could not create auxiliary timer\n");
}
- isa_register_portio_list (dev, s->port, sb16_ioport_list, s, "sb16");
+ isa_register_portio_list (isadev, s->port, sb16_ioport_list, s, "sb16");
DMA_register_channel (s->hdma, SB_read_DMA, s);
DMA_register_channel (s->dma, SB_read_DMA, s);
s->can_write = 1;
AUD_register_card ("sb16", &s->card);
- return 0;
}
static int SB16_init (ISABus *bus)
@@ -1404,8 +1410,8 @@ static Property sb16_properties[] = {
static void sb16_class_initfn (ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS (klass);
- ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
- ic->init = sb16_initfn;
+
+ dc->realize = sb16_realizefn;
dc->desc = "Creative Sound Blaster 16";
dc->vmsd = &vmstate_sb16;
dc->props = sb16_properties;
@@ -1415,6 +1421,7 @@ static const TypeInfo sb16_info = {
.name = TYPE_SB16,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof (SB16State),
+ .instance_init = sb16_initfn,
.class_init = sb16_class_initfn,
};