mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
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:
parent
5adf5f4dee
commit
19ba32651d
1 changed files with 7 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue