1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:57:44 +00:00

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -26,7 +26,7 @@ u8 MemoryBackedHostBridge::read8_field(BusNumber bus, DeviceNumber device, Funct
{
VERIFY(Access::the().access_lock().is_locked());
VERIFY(field <= 0xfff);
return *((volatile u8*)(get_device_configuration_memory_mapped_space(bus, device, function).get() + (field & 0xfff)));
return *((u8 volatile*)(get_device_configuration_memory_mapped_space(bus, device, function).get() + (field & 0xfff)));
}
u16 MemoryBackedHostBridge::read16_field(BusNumber bus, DeviceNumber device, FunctionNumber function, u32 field)
{
@ -48,7 +48,7 @@ void MemoryBackedHostBridge::write8_field(BusNumber bus, DeviceNumber device, Fu
{
VERIFY(Access::the().access_lock().is_locked());
VERIFY(field <= 0xfff);
*((volatile u8*)(get_device_configuration_memory_mapped_space(bus, device, function).get() + (field & 0xfff))) = value;
*((u8 volatile*)(get_device_configuration_memory_mapped_space(bus, device, function).get() + (field & 0xfff))) = value;
}
void MemoryBackedHostBridge::write16_field(BusNumber bus, DeviceNumber device, FunctionNumber function, u32 field, u16 value)
{

View file

@ -115,11 +115,11 @@ struct HardwareID {
bool is_null() const { return !vendor_id && !device_id; }
bool operator==(const HardwareID& other) const
bool operator==(HardwareID const& other) const
{
return vendor_id == other.vendor_id && device_id == other.device_id;
}
bool operator!=(const HardwareID& other) const
bool operator!=(HardwareID const& other) const
{
return vendor_id != other.vendor_id || device_id != other.device_id;
}
@ -162,24 +162,24 @@ public:
{
}
Address(const Address& address) = default;
Address(Address const& address) = default;
bool is_null() const { return !m_bus && !m_device && !m_function; }
operator bool() const { return !is_null(); }
// Disable default implementations that would use surprising integer promotion.
bool operator<=(const Address&) const = delete;
bool operator>=(const Address&) const = delete;
bool operator<(const Address&) const = delete;
bool operator>(const Address&) const = delete;
bool operator<=(Address const&) const = delete;
bool operator>=(Address const&) const = delete;
bool operator<(Address const&) const = delete;
bool operator>(Address const&) const = delete;
bool operator==(const Address& other) const
bool operator==(Address const& other) const
{
if (this == &other)
return true;
return m_domain == other.m_domain && m_bus == other.m_bus && m_device == other.m_device && m_function == other.m_function;
}
bool operator!=(const Address& other) const
bool operator!=(Address const& other) const
{
return !(*this == other);
}
@ -198,7 +198,7 @@ private:
class Capability {
public:
Capability(const Address& address, u8 id, u8 ptr)
Capability(Address const& address, u8 id, u8 ptr)
: m_address(address)
, m_id(id)
, m_ptr(ptr)
@ -246,7 +246,7 @@ public:
, m_capabilities(capabilities)
{
if constexpr (PCI_DEBUG) {
for (const auto& capability : capabilities)
for (auto const& capability : capabilities)
dbgln("{} has capability {}", address, capability.id());
}
}

View file

@ -12,14 +12,14 @@
namespace Kernel::PCI {
UNMAP_AFTER_INIT NonnullRefPtr<PCIDeviceSysFSDirectory> PCIDeviceSysFSDirectory::create(const SysFSDirectory& parent_directory, Address address)
UNMAP_AFTER_INIT NonnullRefPtr<PCIDeviceSysFSDirectory> PCIDeviceSysFSDirectory::create(SysFSDirectory const& parent_directory, Address address)
{
// FIXME: Handle allocation failure gracefully
auto device_name = MUST(KString::formatted("{:04x}:{:02x}:{:02x}.{}", address.domain(), address.bus(), address.device(), address.function()));
return adopt_ref(*new (nothrow) PCIDeviceSysFSDirectory(move(device_name), parent_directory, address));
}
UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, const SysFSDirectory& parent_directory, Address address)
UNMAP_AFTER_INIT PCIDeviceSysFSDirectory::PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, SysFSDirectory const& parent_directory, Address address)
: SysFSDirectory(parent_directory)
, m_address(address)
, m_device_directory_name(move(device_directory_name))
@ -92,12 +92,12 @@ StringView PCIDeviceAttributeSysFSComponent::name() const
}
}
NonnullRefPtr<PCIDeviceAttributeSysFSComponent> PCIDeviceAttributeSysFSComponent::create(const PCIDeviceSysFSDirectory& device, PCI::RegisterOffset offset, size_t field_bytes_width)
NonnullRefPtr<PCIDeviceAttributeSysFSComponent> PCIDeviceAttributeSysFSComponent::create(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width)
{
return adopt_ref(*new (nothrow) PCIDeviceAttributeSysFSComponent(device, offset, field_bytes_width));
}
PCIDeviceAttributeSysFSComponent::PCIDeviceAttributeSysFSComponent(const PCIDeviceSysFSDirectory& device, PCI::RegisterOffset offset, size_t field_bytes_width)
PCIDeviceAttributeSysFSComponent::PCIDeviceAttributeSysFSComponent(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width)
: SysFSComponent()
, m_device(device)
, m_offset(offset)

View file

@ -23,13 +23,13 @@ private:
class PCIDeviceSysFSDirectory final : public SysFSDirectory {
public:
static NonnullRefPtr<PCIDeviceSysFSDirectory> create(const SysFSDirectory&, Address);
const Address& address() const { return m_address; }
static NonnullRefPtr<PCIDeviceSysFSDirectory> create(SysFSDirectory const&, Address);
Address const& address() const { return m_address; }
virtual StringView name() const override { return m_device_directory_name->view(); }
private:
PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, const SysFSDirectory&, Address);
PCIDeviceSysFSDirectory(NonnullOwnPtr<KString> device_directory_name, SysFSDirectory const&, Address);
Address m_address;
@ -38,7 +38,7 @@ private:
class PCIDeviceAttributeSysFSComponent : public SysFSComponent {
public:
static NonnullRefPtr<PCIDeviceAttributeSysFSComponent> create(const PCIDeviceSysFSDirectory& device, PCI::RegisterOffset offset, size_t field_bytes_width);
static NonnullRefPtr<PCIDeviceAttributeSysFSComponent> create(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width);
virtual ErrorOr<size_t> read_bytes(off_t, size_t, UserOrKernelBuffer&, OpenFileDescription*) const override;
virtual ~PCIDeviceAttributeSysFSComponent() {};
@ -47,7 +47,7 @@ public:
protected:
ErrorOr<NonnullOwnPtr<KBuffer>> try_to_generate_buffer() const;
PCIDeviceAttributeSysFSComponent(const PCIDeviceSysFSDirectory& device, PCI::RegisterOffset offset, size_t field_bytes_width);
PCIDeviceAttributeSysFSComponent(PCIDeviceSysFSDirectory const& device, PCI::RegisterOffset offset, size_t field_bytes_width);
NonnullRefPtr<PCIDeviceSysFSDirectory> m_device;
PCI::RegisterOffset m_offset;
size_t m_field_bytes_width;