mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 17:40:27 +00:00
Kernel/HID: Don't use *LockRefPtrs in the I8042Controller code
This commit is contained in:
parent
747efc5265
commit
32557be930
Notes:
sideshowbarker
2024-07-17 07:19:27 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/32557be930 Pull-request: https://github.com/SerenityOS/serenity/pull/18386
4 changed files with 8 additions and 6 deletions
|
@ -17,9 +17,9 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
UNMAP_AFTER_INIT NonnullLockRefPtr<I8042Controller> I8042Controller::initialize()
|
UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<I8042Controller>> I8042Controller::create()
|
||||||
{
|
{
|
||||||
return adopt_lock_ref(*new I8042Controller());
|
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) I8042Controller()));
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT I8042Controller::I8042Controller()
|
UNMAP_AFTER_INIT I8042Controller::I8042Controller()
|
||||||
|
|
|
@ -90,7 +90,7 @@ protected:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullLockRefPtr<I8042Controller> m_i8042_controller;
|
NonnullRefPtr<I8042Controller> const m_i8042_controller;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PS2KeyboardDevice;
|
class PS2KeyboardDevice;
|
||||||
|
@ -101,7 +101,7 @@ class I8042Controller final : public HIDController {
|
||||||
friend class PS2MouseDevice;
|
friend class PS2MouseDevice;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static NonnullLockRefPtr<I8042Controller> initialize();
|
static ErrorOr<NonnullRefPtr<I8042Controller>> create();
|
||||||
|
|
||||||
ErrorOr<void> detect_devices();
|
ErrorOr<void> detect_devices();
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <AK/AtomicRefCounted.h>
|
#include <AK/AtomicRefCounted.h>
|
||||||
#include <AK/IntrusiveList.h>
|
#include <AK/IntrusiveList.h>
|
||||||
|
#include <AK/NonnullRefPtr.h>
|
||||||
|
#include <AK/RefPtr.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -22,7 +24,7 @@ protected:
|
||||||
HIDController() = default;
|
HIDController() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IntrusiveListNode<HIDController, NonnullLockRefPtr<HIDController>> m_list_node;
|
IntrusiveListNode<HIDController, NonnullRefPtr<HIDController>> m_list_node;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ UNMAP_AFTER_INIT ErrorOr<void> HIDManagement::enumerate()
|
||||||
// set to emulate PS/2, we should not initialize the PS/2 controller.
|
// set to emulate PS/2, we should not initialize the PS/2 controller.
|
||||||
#if ARCH(X86_64)
|
#if ARCH(X86_64)
|
||||||
auto has_i8042_controller = false;
|
auto has_i8042_controller = false;
|
||||||
auto i8042_controller = I8042Controller::initialize();
|
auto i8042_controller = TRY(I8042Controller::create());
|
||||||
switch (kernel_command_line().i8042_presence_mode()) {
|
switch (kernel_command_line().i8042_presence_mode()) {
|
||||||
case I8042PresenceMode::Automatic: {
|
case I8042PresenceMode::Automatic: {
|
||||||
// Note: If ACPI is disabled or doesn't indicate that we have an i8042, we
|
// Note: If ACPI is disabled or doesn't indicate that we have an i8042, we
|
||||||
|
|
Loading…
Reference in a new issue