audio: rework pcspk_init()
Instead of creating and returning the pc speaker accept it as argument. That allows to rework the initialization workflow in followup patches. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20200702132525.6849-16-kraxel@redhat.com
This commit is contained in:
parent
dea1fb887c
commit
525d654d7a
@ -1219,7 +1219,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
|
||||
/* connect PIT to output control line of the HPET */
|
||||
qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(DEVICE(pit), 0));
|
||||
}
|
||||
pcspk_init(isa_bus, pit);
|
||||
pcspk_init(isa_new(TYPE_PC_SPEAKER), isa_bus, pit);
|
||||
}
|
||||
|
||||
i8257_dma_init(isa_bus, 0);
|
||||
|
@ -102,7 +102,7 @@ static void i82378_realize(PCIDevice *pci, Error **errp)
|
||||
pit = i8254_pit_init(isabus, 0x40, 0, NULL);
|
||||
|
||||
/* speaker */
|
||||
pcspk_init(isabus, pit);
|
||||
pcspk_init(isa_new(TYPE_PC_SPEAKER), isabus, pit);
|
||||
|
||||
/* 2 82C37 (dma) */
|
||||
isa_create_simple(isabus, "i82374");
|
||||
|
@ -250,7 +250,7 @@ static void mips_jazz_init(MachineState *machine,
|
||||
isa_bus_irqs(isa_bus, i8259);
|
||||
i8257_dma_init(isa_bus, 0);
|
||||
pit = i8254_pit_init(isa_bus, 0x40, 0, NULL);
|
||||
pcspk_init(isa_bus, pit);
|
||||
pcspk_init(isa_new(TYPE_PC_SPEAKER), isa_bus, pit);
|
||||
|
||||
/* Video card */
|
||||
switch (jazz_model) {
|
||||
|
@ -31,18 +31,14 @@
|
||||
|
||||
#define TYPE_PC_SPEAKER "isa-pcspk"
|
||||
|
||||
static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit)
|
||||
static inline void pcspk_init(ISADevice *isadev, ISABus *bus, ISADevice *pit)
|
||||
{
|
||||
DeviceState *dev;
|
||||
ISADevice *isadev;
|
||||
|
||||
isadev = isa_new(TYPE_PC_SPEAKER);
|
||||
dev = DEVICE(isadev);
|
||||
qdev_prop_set_uint32(dev, "iobase", 0x61);
|
||||
object_property_set_link(OBJECT(dev), OBJECT(pit), "pit", NULL);
|
||||
isa_realize_and_unref(isadev, bus, &error_fatal);
|
||||
|
||||
return isadev;
|
||||
}
|
||||
|
||||
#endif /* HW_PCSPK_H */
|
||||
|
Loading…
Reference in New Issue
Block a user