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

Kernel/SysFS: Adapt USB plug code to work with SysFS patterns

This commit is contained in:
Liav A 2022-04-23 09:45:31 +03:00 committed by Andreas Kling
parent 70afa0b171
commit cdab213750
6 changed files with 36 additions and 47 deletions

View file

@ -6,7 +6,9 @@
#pragma once
#include <AK/Badge.h>
#include <Kernel/Bus/USB/USBDevice.h>
#include <Kernel/Bus/USB/USBHub.h>
#include <Kernel/FileSystem/SysFS/Component.h>
#include <Kernel/FileSystem/SysFS/Subsystems/Bus/USB/DeviceInformation.h>
#include <Kernel/Locking/Spinlock.h>
@ -20,15 +22,11 @@ public:
virtual StringView name() const override { return "usb"sv; }
void plug(USB::Device&);
void unplug(USB::Device&);
void plug(Badge<USB::Hub>, SysFSUSBDeviceInformation&);
void unplug(Badge<USB::Hub>, SysFSUSBDeviceInformation&);
private:
explicit SysFSUSBBusDirectory(SysFSBusDirectory&);
RefPtr<SysFSUSBDeviceInformation> device_node_for(USB::Device& device);
IntrusiveList<&SysFSUSBDeviceInformation::m_list_node> m_device_nodes;
mutable Spinlock m_lock;
};