1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

Kernel/Devices: Use try_create_device helper for SB16

This commit is contained in:
Liav A 2021-09-16 22:24:55 +03:00 committed by Idan Horowitz
parent fd4397a430
commit 44f5f72add
5 changed files with 26 additions and 22 deletions

View file

@ -18,6 +18,7 @@
#include <Kernel/Devices/ConsoleDevice.h>
#include <Kernel/Devices/Device.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/Devices/SB16.h>
#include <Kernel/UnixTypes.h>
namespace Kernel {
@ -34,6 +35,9 @@ public:
bool is_console_device_attached() const { return !m_console_device.is_null(); }
void attach_console_device(ConsoleDevice const&);
// FIXME: Once we have a singleton for managing many sound cards, remove this from here
void attach_sb16_device(SB16 const&);
void after_inserting_device(Badge<Device>, Device&);
void before_device_removal(Badge<Device>, Device&);
@ -57,6 +61,8 @@ public:
private:
RefPtr<NullDevice> m_null_device;
RefPtr<ConsoleDevice> m_console_device;
// FIXME: Once we have a singleton for managing many sound cards, remove this from here
RefPtr<SB16> m_sb16_device;
MutexProtected<HashMap<u32, Device*>> m_devices;
};