mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +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
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/AnyOf.h>
|
||||||
#include <Kernel/Bus/PCI/API.h>
|
#include <Kernel/Bus/PCI/API.h>
|
||||||
#include <Kernel/Bus/PCI/Device.h>
|
#include <Kernel/Bus/PCI/Device.h>
|
||||||
|
|
||||||
|
@ -17,19 +18,15 @@ Device::Device(Address address)
|
||||||
|
|
||||||
bool Device::is_msi_capable() const
|
bool Device::is_msi_capable() const
|
||||||
{
|
{
|
||||||
for (const auto& capability : PCI::get_device_identifier(pci_address()).capabilities()) {
|
return AK::any_of(
|
||||||
if (capability.id().value() == PCI::Capabilities::ID::MSI)
|
PCI::get_device_identifier(pci_address()).capabilities(),
|
||||||
return true;
|
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSI; });
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
bool Device::is_msix_capable() const
|
bool Device::is_msix_capable() const
|
||||||
{
|
{
|
||||||
for (const auto& capability : PCI::get_device_identifier(pci_address()).capabilities()) {
|
return AK::any_of(
|
||||||
if (capability.id().value() == PCI::Capabilities::ID::MSIX)
|
PCI::get_device_identifier(pci_address()).capabilities(),
|
||||||
return true;
|
[](auto const& capability) { return capability.id().value() == PCI::Capabilities::ID::MSIX; });
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::enable_pin_based_interrupts() const
|
void Device::enable_pin_based_interrupts() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue