[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/20] audio: rework pcspk_init()
From: |
Gerd Hoffmann |
Subject: |
[PULL 15/20] audio: rework pcspk_init() |
Date: |
Mon, 6 Jul 2020 21:29:16 +0200 |
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
---
include/hw/audio/pcspk.h | 6 +-----
hw/i386/pc.c | 2 +-
hw/isa/i82378.c | 2 +-
hw/mips/jazz.c | 2 +-
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/include/hw/audio/pcspk.h b/include/hw/audio/pcspk.h
index 7e7f5f49dcb0..8b485602675f 100644
--- a/include/hw/audio/pcspk.h
+++ b/include/hw/audio/pcspk.h
@@ -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 */
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 407c782b5d42..4fc1b7048b28 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -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);
diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c
index d9e6c7fa0096..75a2da288157 100644
--- a/hw/isa/i82378.c
+++ b/hw/isa/i82378.c
@@ -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");
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
index c3b0da60ccc1..0002bff69590 100644
--- a/hw/mips/jazz.c
+++ b/hw/mips/jazz.c
@@ -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) {
--
2.18.4
- [PULL 00/20] Audio 20200706 patches, Gerd Hoffmann, 2020/07/06
- [PULL 02/20] stubs: add pci_create_simple, Gerd Hoffmann, 2020/07/06
- [PULL 03/20] audio: add deprecated_register_soundhw, Gerd Hoffmann, 2020/07/06
- [PULL 12/20] pc_basic_device_init: drop has_pit arg, Gerd Hoffmann, 2020/07/06
- [PULL 01/20] stubs: add isa_create_simple, Gerd Hoffmann, 2020/07/06
- [PULL 04/20] audio: deprecate -soundhw ac97, Gerd Hoffmann, 2020/07/06
- [PULL 09/20] audio: deprecate -soundhw sb16, Gerd Hoffmann, 2020/07/06
- [PULL 15/20] audio: rework pcspk_init(),
Gerd Hoffmann <=
- [PULL 08/20] audio: deprecate -soundhw gus, Gerd Hoffmann, 2020/07/06
- [PULL 19/20] pcspk: update docs/system/target-i386-desc.rst.inc, Gerd Hoffmann, 2020/07/06
- [PULL 17/20] audio: deprecate -soundhw pcspk, Gerd Hoffmann, 2020/07/06
- [PULL 06/20] audio: deprecate -soundhw adlib, Gerd Hoffmann, 2020/07/06
- [PULL 18/20] audio: add soundhw deprecation notice, Gerd Hoffmann, 2020/07/06
- [PULL 07/20] audio: deprecate -soundhw cs4231a, Gerd Hoffmann, 2020/07/06
- [PULL 13/20] pc_basic_device_init: drop no_vmport arg, Gerd Hoffmann, 2020/07/06
- [PULL 10/20] audio: deprecate -soundhw hda, Gerd Hoffmann, 2020/07/06
- [PULL 16/20] audio: create pcspk device early, Gerd Hoffmann, 2020/07/06
- [PULL 11/20] pc_basic_device_init: pass PCMachineState, Gerd Hoffmann, 2020/07/06