mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Use StringView literals in VirtIO::determine_device_class()
Since the return type is StringView we can just create them at compile time and avoid the run-time construction.
This commit is contained in:
parent
35116c9117
commit
53cf28c47c
Notes:
sideshowbarker
2024-07-18 03:39:30 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/53cf28c47c8 Pull-request: https://github.com/SerenityOS/serenity/pull/10141 Reviewed-by: https://github.com/supercomputer7
1 changed files with 15 additions and 13 deletions
|
@ -54,34 +54,36 @@ StringView determine_device_class(const PCI::Address& address)
|
|||
auto subsystem_device_id = PCI::get_subsystem_id(address);
|
||||
switch (subsystem_device_id) {
|
||||
case 1:
|
||||
return "VirtIONetAdapter";
|
||||
return "VirtIONetAdapter"sv;
|
||||
case 2:
|
||||
return "VirtIOBlockDevice";
|
||||
return "VirtIOBlockDevice"sv;
|
||||
case 3:
|
||||
return "VirtIOConsole";
|
||||
return "VirtIOConsole"sv;
|
||||
case 4:
|
||||
return "VirtIORNG";
|
||||
return "VirtIORNG"sv;
|
||||
default:
|
||||
dbgln("VirtIO: Unknown subsystem_device_id {}", subsystem_device_id);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
dbgln("VirtIO: Unknown subsystem_device_id {}", subsystem_device_id);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
auto id = PCI::get_id(address);
|
||||
VERIFY(id.vendor_id == PCI::VendorID::VirtIO);
|
||||
switch (id.device_id) {
|
||||
case PCI::DeviceID::VirtIONetAdapter:
|
||||
return "VirtIONetAdapter";
|
||||
return "VirtIONetAdapter"sv;
|
||||
case PCI::DeviceID::VirtIOBlockDevice:
|
||||
return "VirtIOBlockDevice";
|
||||
return "VirtIOBlockDevice"sv;
|
||||
case PCI::DeviceID::VirtIOConsole:
|
||||
return "VirtIOConsole";
|
||||
return "VirtIOConsole"sv;
|
||||
case PCI::DeviceID::VirtIOEntropy:
|
||||
return "VirtIORNG";
|
||||
return "VirtIORNG"sv;
|
||||
case PCI::DeviceID::VirtIOGPU:
|
||||
return "VirtIOGPU";
|
||||
return "VirtIOGPU"sv;
|
||||
default:
|
||||
dbgln("VirtIO: Unknown device_id {}", id.vendor_id);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
dbgln("VirtIO: Unknown device_id {}", id.vendor_id);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void Device::initialize()
|
||||
|
|
Loading…
Reference in a new issue