summaryrefslogtreecommitdiff
path: root/Kernel/Devices/HID/PS2MouseDevice.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-09-11 09:19:20 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2021-09-17 01:02:48 +0300
commitaee4786d8e80a2a4b2b2422afc4f8f342433c599 (patch)
tree1cdedafb91c7f405ff75a53f3c33cacf86d7167b /Kernel/Devices/HID/PS2MouseDevice.h
parent9aa6dd6b786d42f6c131d03cba58e9999e0644d0 (diff)
downloadserenity-aee4786d8e80a2a4b2b2422afc4f8f342433c599.zip
Kernel: Introduce the DeviceManagement singleton
This singleton simplifies many aspects that we struggled with before: 1. There's no need to make derived classes of Device expose the constructor as public anymore. The singleton is a friend of them, so he can call the constructor. This solves the issue with try_create_device helper neatly, hopefully for good. 2. Getting a reference of the NullDevice is now being done from this singleton, which means that NullDevice no longer needs to use its own singleton, and we can apply the try_create_device helper on it too :) 3. We can now defer registration completely after the Device constructor which means the Device constructor is merely assigning the major and minor numbers of the Device, and the try_create_device helper ensures it calls the after_inserting method immediately after construction. This creates a great opportunity to make registration more OOM-safe.
Diffstat (limited to 'Kernel/Devices/HID/PS2MouseDevice.h')
-rw-r--r--Kernel/Devices/HID/PS2MouseDevice.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Devices/HID/PS2MouseDevice.h b/Kernel/Devices/HID/PS2MouseDevice.h
index fc3b84cd00..b232bf2d1f 100644
--- a/Kernel/Devices/HID/PS2MouseDevice.h
+++ b/Kernel/Devices/HID/PS2MouseDevice.h
@@ -17,6 +17,8 @@ namespace Kernel {
class PS2MouseDevice : public IRQHandler
, public MouseDevice
, public I8042Device {
+ friend class DeviceManagement;
+
public:
static RefPtr<PS2MouseDevice> try_to_initialize(const I8042Controller&);
bool initialize();
@@ -32,10 +34,9 @@ public:
enable_irq();
}
- // FIXME: We expose this constructor to make try_create_device helper to work
+protected:
explicit PS2MouseDevice(const I8042Controller&);
-protected:
// ^IRQHandler
virtual bool handle_irq(const RegisterState&) override;