diff options
author | Hendiadyoin1 <leon2002.la@gmail.com> | 2021-12-08 13:42:21 +0100 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-12-09 22:53:42 -0800 |
commit | 19ba32651dbe667ae5307ac1a30242ef66d89bc8 (patch) | |
tree | 8a9bf3fbbe96844486e1853b8f0e2c76ebd3279a | |
parent | 5adf5f4dee012a0e67535da2d7a622096e8d2f3c (diff) | |
download | serenity-19ba32651dbe667ae5307ac1a30242ef66d89bc8.zip |
Kernel: Use AK:any_of in PCI::Device capability checks
This is equivalent to std::any_of as clang-tidy suggests.
-rw-r--r-- | Kernel/Bus/PCI/Device.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Kernel/Bus/PCI/Device.cpp b/Kernel/Bus/PCI/Device.cpp index 66239a426e..058503a133 100644 --- a/Kernel/Bus/PCI/Device.cpp +++ b/Kernel/Bus/PCI/Device.cpp @@ -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 |