mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:32:46 +00:00 
			
		
		
		
	Kernel: Introduce a new super class called HIDController
Use the new class in HID code, because all other HID device controllers will be using this class as their parent class. Hence, we no longer keep a reference to any PS/2 device in HIDManagement and rely on HIDController derived classes to do this for us. It also means that we removed another instance of a LockRefPtr, which is designated to be removed and is replaced by the better pattern of SpinlockProtected<RefPtr<>> instead.
This commit is contained in:
		
							parent
							
								
									6c4a47d916
								
							
						
					
					
						commit
						d76c08c9b0
					
				
					 5 changed files with 39 additions and 25 deletions
				
			
		|  | @ -19,15 +19,6 @@ UNMAP_AFTER_INIT NonnullLockRefPtr<I8042Controller> I8042Controller::initialize( | |||
|     return adopt_lock_ref(*new I8042Controller()); | ||||
| } | ||||
| 
 | ||||
| LockRefPtr<MouseDevice> I8042Controller::mouse() const | ||||
| { | ||||
|     return m_mouse_device; | ||||
| } | ||||
| LockRefPtr<KeyboardDevice> I8042Controller::keyboard() const | ||||
| { | ||||
|     return m_keyboard_device; | ||||
| } | ||||
| 
 | ||||
| UNMAP_AFTER_INIT I8042Controller::I8042Controller() | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/AtomicRefCounted.h> | ||||
| #include <Kernel/Devices/HID/Controller.h> | ||||
| #include <Kernel/Devices/HID/KeyboardDevice.h> | ||||
| #include <Kernel/Devices/HID/MouseDevice.h> | ||||
| #include <Kernel/Locking/Spinlock.h> | ||||
|  | @ -84,7 +85,7 @@ protected: | |||
| class PS2KeyboardDevice; | ||||
| class PS2MouseDevice; | ||||
| class HIDManagement; | ||||
| class I8042Controller final : public AtomicRefCounted<I8042Controller> { | ||||
| class I8042Controller final : public HIDController { | ||||
|     friend class PS2KeyboardDevice; | ||||
|     friend class PS2MouseDevice; | ||||
| 
 | ||||
|  | @ -133,9 +134,6 @@ public: | |||
| 
 | ||||
|     bool irq_process_input_buffer(HIDDevice::Type); | ||||
| 
 | ||||
|     LockRefPtr<MouseDevice> mouse() const; | ||||
|     LockRefPtr<KeyboardDevice> keyboard() const; | ||||
| 
 | ||||
|     // Note: This function exists only for the initialization process of the controller
 | ||||
|     bool check_existence_via_probing(Badge<HIDManagement>); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A