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

Kernel: Switch singletons to use new Singleton class

Fixes #3226
This commit is contained in:
Tom 2020-08-20 09:36:06 -06:00 committed by Andreas Kling
parent 527c8047fe
commit f48feae0b2
44 changed files with 184 additions and 146 deletions

View file

@ -31,6 +31,7 @@
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Devices/KeyboardDevice.h>
#include <Kernel/IO.h>
#include <Kernel/Singleton.h>
#include <Kernel/TTY/VirtualConsole.h>
//#define KEYBOARD_DEBUG
@ -335,11 +336,15 @@ void KeyboardDevice::handle_irq(const RegisterState&)
}
}
static KeyboardDevice* s_the;
static auto s_the = make_singleton<KeyboardDevice>();
void KeyboardDevice::initialize()
{
s_the.ensure_instance();
}
KeyboardDevice& KeyboardDevice::the()
{
ASSERT(s_the);
return *s_the;
}
@ -347,8 +352,6 @@ KeyboardDevice::KeyboardDevice()
: IRQHandler(IRQ_KEYBOARD)
, CharacterDevice(85, 1)
{
s_the = this;
// Empty the buffer of any pending data.
// I don't care what you've been pressing until now!
while (IO::in8(I8042_STATUS) & I8042_BUFFER_FULL)