mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel/Audio: Don't try to enumerate PCI adapters if PCI is disabled
This commit is contained in:
parent
71de4f7114
commit
15315be55c
Notes:
sideshowbarker
2024-07-17 18:02:16 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/15315be55c Pull-request: https://github.com/SerenityOS/serenity/pull/12046
1 changed files with 16 additions and 14 deletions
|
@ -38,21 +38,23 @@ UNMAP_AFTER_INIT AudioManagement::AudioManagement()
|
|||
|
||||
UNMAP_AFTER_INIT void AudioManagement::enumerate_hardware_controllers()
|
||||
{
|
||||
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
||||
// Note: Only consider PCI audio controllers
|
||||
if (device_identifier.class_code().value() != to_underlying(PCI::ClassID::Multimedia)
|
||||
|| device_identifier.subclass_code().value() != to_underlying(PCI::Multimedia::SubclassID::AudioController))
|
||||
return;
|
||||
if (!PCI::Access::is_disabled()) {
|
||||
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
||||
// Note: Only consider PCI audio controllers
|
||||
if (device_identifier.class_code().value() != to_underlying(PCI::ClassID::Multimedia)
|
||||
|| device_identifier.subclass_code().value() != to_underlying(PCI::Multimedia::SubclassID::AudioController))
|
||||
return;
|
||||
|
||||
dbgln("AC97: found audio controller at {}", device_identifier.address());
|
||||
auto ac97_device = AC97::try_create(device_identifier);
|
||||
if (ac97_device.is_error()) {
|
||||
// FIXME: Propagate errors properly
|
||||
dbgln("AudioManagement: failed to initialize AC97 device: {}", ac97_device.error());
|
||||
return;
|
||||
}
|
||||
m_controllers_list.append(ac97_device.release_value());
|
||||
});
|
||||
dbgln("AC97: found audio controller at {}", device_identifier.address());
|
||||
auto ac97_device = AC97::try_create(device_identifier);
|
||||
if (ac97_device.is_error()) {
|
||||
// FIXME: Propagate errors properly
|
||||
dbgln("AudioManagement: failed to initialize AC97 device: {}", ac97_device.error());
|
||||
return;
|
||||
}
|
||||
m_controllers_list.append(ac97_device.release_value());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void AudioManagement::enumerate_hardware_audio_channels()
|
||||
|
|
Loading…
Reference in a new issue