Kernel: Use AK:any_of in PCI::Device capability checks

This is equivalent to std::any_of as clang-tidy suggests.
This commit is contained in:
Hendiadyoin1 2021-12-08 13:42:21 +01:00 committed by Brian Gianforcaro
parent 5adf5f4dee
commit 19ba32651d
Notes: sideshowbarker 2024-07-17 23:01:07 +09:00

View File

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/AnyOf.h>
#include <Kernel/Bus/PCI/API.h>
#include <Kernel/Bus/PCI/Device.h>
@ -17,19 +18,15 @@ Device::Device(Address address)
bool Device::is_msi_capable() const
{
for (const auto& capability : PCI::get_device_identifier(pci_address()).capabilities()) {
if (capability.id().value() == PCI::Capabilities::ID::MSI)
return true;
}
return false;
return AK::any_of(
PCI::get_device_identifier(pci_address()).capabilities(),
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSI; });
}
bool Device::is_msix_capable() const
{
for (const auto& capability : PCI::get_device_identifier(pci_address()).capabilities()) {
if (capability.id().value() == PCI::Capabilities::ID::MSIX)
return true;
}
return false;
return AK::any_of(
PCI::get_device_identifier(pci_address()).capabilities(),
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSIX; });
}
void Device::enable_pin_based_interrupts() const