Skip to content

Commit 6b8d141

Browse files
committed
audio: create pcspk device early
Create the pcspk device early, so it exists at machine type initialization time. Signed-off-by: Gerd Hoffmann <[email protected]> Message-id: [email protected]
1 parent 525d654 commit 6b8d141

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

hw/i386/pc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ void pc_basic_device_init(struct PCMachineState *pcms,
12191219
/* connect PIT to output control line of the HPET */
12201220
qdev_connect_gpio_out(hpet, 0, qdev_get_gpio_in(DEVICE(pit), 0));
12211221
}
1222-
pcspk_init(isa_new(TYPE_PC_SPEAKER), isa_bus, pit);
1222+
pcspk_init(pcms->pcspk, isa_bus, pit);
12231223
}
12241224

12251225
i8257_dma_init(isa_bus, 0);
@@ -1891,6 +1891,7 @@ static void pc_machine_initfn(Object *obj)
18911891
pcms->pit_enabled = true;
18921892

18931893
pc_system_flash_create(pcms);
1894+
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
18941895
}
18951896

18961897
static void pc_machine_reset(MachineState *machine)

include/hw/i386/pc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ struct PCMachineState {
3333
PCIBus *bus;
3434
I2CBus *smbus;
3535
PFlashCFI01 *flash[2];
36+
ISADevice *pcspk;
3637

3738
/* Configuration options: */
3839
uint64_t max_ram_below_4g;

0 commit comments

Comments
 (0)