mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
Kernel: Take EnumerableDeviceIdentifier by const ref instead of by value
It's 48 bytes.
This commit is contained in:
parent
6d255fb92b
commit
08d4b231e1
Notes:
sideshowbarker
2024-07-16 22:22:13 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/08d4b231e1 Pull-request: https://github.com/SerenityOS/serenity/pull/24072 Reviewed-by: https://github.com/spholz
3 changed files with 9 additions and 9 deletions
|
@ -160,7 +160,7 @@ UNMAP_AFTER_INIT void Access::rescan_hardware()
|
|||
SpinlockLocker scan_locker(m_scan_lock);
|
||||
VERIFY(m_device_identifiers.is_empty());
|
||||
for (auto& [_, host_controller] : m_host_controllers) {
|
||||
host_controller->enumerate_attached_devices([this](EnumerableDeviceIdentifier device_identifier) {
|
||||
host_controller->enumerate_attached_devices([this](EnumerableDeviceIdentifier const& device_identifier) {
|
||||
auto device_identifier_or_error = DeviceIdentifier::from_enumerable_identifier(device_identifier);
|
||||
if (device_identifier_or_error.is_error()) {
|
||||
dmesgln("Failed during PCI Access::rescan_hardware due to {}", device_identifier_or_error.error());
|
||||
|
|
|
@ -54,7 +54,7 @@ u16 HostController::read16_field(BusNumber bus, DeviceNumber device, FunctionNum
|
|||
return read16_field(bus, device, function, to_underlying(field));
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_functions(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber bus, DeviceNumber device, FunctionNumber function, bool recursive_search_into_bridges)
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_functions(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber bus, DeviceNumber device, FunctionNumber function, bool recursive_search_into_bridges)
|
||||
{
|
||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating function, bus={}, device={}, function={}", bus, device, function);
|
||||
Address address(domain_number(), bus.value(), device.value(), function.value());
|
||||
|
@ -83,7 +83,7 @@ UNMAP_AFTER_INIT void HostController::enumerate_functions(Function<void(Enumerab
|
|||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_device(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber bus, DeviceNumber device, bool recursive_search_into_bridges)
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_device(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber bus, DeviceNumber device, bool recursive_search_into_bridges)
|
||||
{
|
||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating device in bus={}, device={}", bus, device);
|
||||
if (read16_field(bus, device, 0, PCI::RegisterOffset::VENDOR_ID) == PCI::none_value)
|
||||
|
@ -97,14 +97,14 @@ UNMAP_AFTER_INIT void HostController::enumerate_device(Function<void(EnumerableD
|
|||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_bus(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber bus, bool recursive_search_into_bridges)
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_bus(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber bus, bool recursive_search_into_bridges)
|
||||
{
|
||||
dbgln_if(PCI_DEBUG, "PCI: Enumerating bus {}", bus);
|
||||
for (u8 device = 0; device < 32; ++device)
|
||||
enumerate_device(callback, bus, device, recursive_search_into_bridges);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_attached_devices(Function<void(EnumerableDeviceIdentifier)> callback)
|
||||
UNMAP_AFTER_INIT void HostController::enumerate_attached_devices(Function<void(EnumerableDeviceIdentifier const&)> callback)
|
||||
{
|
||||
VERIFY(Access::the().access_lock().is_locked());
|
||||
VERIFY(Access::the().scan_lock().is_locked());
|
||||
|
|
|
@ -31,12 +31,12 @@ public:
|
|||
|
||||
u32 domain_number() const { return m_domain.domain_number(); }
|
||||
|
||||
void enumerate_attached_devices(Function<void(EnumerableDeviceIdentifier)> callback);
|
||||
void enumerate_attached_devices(Function<void(EnumerableDeviceIdentifier const&)> callback);
|
||||
|
||||
private:
|
||||
void enumerate_bus(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber, bool recursive);
|
||||
void enumerate_functions(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber, DeviceNumber, FunctionNumber, bool recursive);
|
||||
void enumerate_device(Function<void(EnumerableDeviceIdentifier)> const& callback, BusNumber bus, DeviceNumber device, bool recursive);
|
||||
void enumerate_bus(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber, bool recursive_search_into_bridges);
|
||||
void enumerate_functions(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber, DeviceNumber, FunctionNumber, bool recursive_search_into_bridges);
|
||||
void enumerate_device(Function<void(EnumerableDeviceIdentifier const&)> const& callback, BusNumber bus, DeviceNumber device, bool recursive_search_into_bridges);
|
||||
|
||||
u8 read8_field(BusNumber, DeviceNumber, FunctionNumber, RegisterOffset field);
|
||||
u16 read16_field(BusNumber, DeviceNumber, FunctionNumber, RegisterOffset field);
|
||||
|
|
Loading…
Reference in a new issue