mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:27:35 +00:00
Kernel: Some clang-tidy fixes in Bus/VirtIO
This commit is contained in:
parent
471b38db68
commit
9be409585c
5 changed files with 11 additions and 9 deletions
|
@ -22,7 +22,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<Console> Console::must_create(PCI::DeviceIdentifi
|
||||||
UNMAP_AFTER_INIT void Console::initialize()
|
UNMAP_AFTER_INIT void Console::initialize()
|
||||||
{
|
{
|
||||||
Device::initialize();
|
Device::initialize();
|
||||||
if (auto cfg = get_config(ConfigurationType::Device)) {
|
if (auto const* cfg = get_config(ConfigurationType::Device)) {
|
||||||
bool success = negotiate_features([&](u64 supported_features) {
|
bool success = negotiate_features([&](u64 supported_features) {
|
||||||
u64 negotiated = 0;
|
u64 negotiated = 0;
|
||||||
if (is_feature_set(supported_features, VIRTIO_CONSOLE_F_SIZE))
|
if (is_feature_set(supported_features, VIRTIO_CONSOLE_F_SIZE))
|
||||||
|
@ -156,7 +156,8 @@ void Console::process_control_message(ControlMessage message)
|
||||||
if (id >= m_ports.size()) {
|
if (id >= m_ports.size()) {
|
||||||
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", id, m_ports.size());
|
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", id, m_ports.size());
|
||||||
return;
|
return;
|
||||||
} else if (!m_ports.at(id).is_null()) {
|
}
|
||||||
|
if (!m_ports.at(id).is_null()) {
|
||||||
dbgln("Device tried to add port {} which was already added!", id);
|
dbgln("Device tried to add port {} which was already added!", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +179,8 @@ void Console::process_control_message(ControlMessage message)
|
||||||
if (message.id >= m_ports.size()) {
|
if (message.id >= m_ports.size()) {
|
||||||
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", message.id, m_ports.size());
|
dbgln("Device provided an invalid port number {}. max_nr_ports: {}", message.id, m_ports.size());
|
||||||
return;
|
return;
|
||||||
} else if (m_ports.at(message.id).is_null()) {
|
}
|
||||||
|
if (m_ports.at(message.id).is_null()) {
|
||||||
dbgln("Device tried to open port {} which was not added!", message.id);
|
dbgln("Device tried to open port {} which was not added!", message.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ UNMAP_AFTER_INIT void detect()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static StringView const determine_device_class(PCI::DeviceIdentifier const& device_identifier)
|
static StringView determine_device_class(PCI::DeviceIdentifier const& device_identifier)
|
||||||
{
|
{
|
||||||
if (device_identifier.revision_id().value() == 0) {
|
if (device_identifier.revision_id().value() == 0) {
|
||||||
// Note: If the device is a legacy (or transitional) device, therefore,
|
// Note: If the device is a legacy (or transitional) device, therefore,
|
||||||
|
|
|
@ -121,7 +121,7 @@ protected:
|
||||||
|
|
||||||
const Configuration* get_config(ConfigurationType cfg_type, u32 index = 0) const
|
const Configuration* get_config(ConfigurationType cfg_type, u32 index = 0) const
|
||||||
{
|
{
|
||||||
for (auto& cfg : m_configs) {
|
for (auto const& cfg : m_configs) {
|
||||||
if (cfg.cfg_type != cfg_type)
|
if (cfg.cfg_type != cfg_type)
|
||||||
continue;
|
continue;
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
|
|
|
@ -118,9 +118,9 @@ Optional<u16> Queue::take_free_slot()
|
||||||
m_free_head = m_descriptors[descriptor_index].next;
|
m_free_head = m_descriptors[descriptor_index].next;
|
||||||
--m_free_buffers;
|
--m_free_buffers;
|
||||||
return descriptor_index;
|
return descriptor_index;
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Queue::should_notify() const
|
bool Queue::should_notify() const
|
||||||
|
|
|
@ -116,8 +116,8 @@ public:
|
||||||
|
|
||||||
QueueChain(QueueChain&& other)
|
QueueChain(QueueChain&& other)
|
||||||
: m_queue(other.m_queue)
|
: m_queue(other.m_queue)
|
||||||
, m_start_of_chain_index(other.m_start_of_chain_index)
|
, m_start_of_chain_index(move(other.m_start_of_chain_index))
|
||||||
, m_end_of_chain_index(other.m_end_of_chain_index)
|
, m_end_of_chain_index(move(other.m_end_of_chain_index))
|
||||||
, m_chain_length(other.m_chain_length)
|
, m_chain_length(other.m_chain_length)
|
||||||
, m_chain_has_writable_pages(other.m_chain_has_writable_pages)
|
, m_chain_has_writable_pages(other.m_chain_has_writable_pages)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue