summaryrefslogtreecommitdiff
path: root/Kernel/Net
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-09-27 17:56:34 -0700
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-10-01 17:22:17 +0000
commitb90cc1148a279804ca88f2f6280067ec87cbfd75 (patch)
tree46745449336cebf7d88257b13fc8fc3f1b0420d0 /Kernel/Net
parent2770433d300e0892498014173f57794291e3f4ba (diff)
downloadserenity-b90cc1148a279804ca88f2f6280067ec87cbfd75.zip
Kernel: Switch RTL8168NetworkAdapter::possible_device_name to StringView
There is no need to allocate a `AK::String` for the device name, when the list of devices is entirely static.
Diffstat (limited to 'Kernel/Net')
-rw-r--r--Kernel/Net/RTL8168NetworkAdapter.cpp28
-rw-r--r--Kernel/Net/RTL8168NetworkAdapter.h2
2 files changed, 15 insertions, 15 deletions
diff --git a/Kernel/Net/RTL8168NetworkAdapter.cpp b/Kernel/Net/RTL8168NetworkAdapter.cpp
index 8e77a3e975..ea5fe8811e 100644
--- a/Kernel/Net/RTL8168NetworkAdapter.cpp
+++ b/Kernel/Net/RTL8168NetworkAdapter.cpp
@@ -1630,55 +1630,55 @@ void RTL8168NetworkAdapter::identify_chip_version()
}
}
-String RTL8168NetworkAdapter::possible_device_name()
+StringView RTL8168NetworkAdapter::possible_device_name()
{
switch (m_version) { // We are following *BSD's versioning scheme, the comments note linux's versioning scheme, but they dont match up exactly
case ChipVersion::Version1:
case ChipVersion::Version2:
case ChipVersion::Version3:
- return "RTL8168B/8111B"; // 11, 12, 17
+ return "RTL8168B/8111B"sv; // 11, 12, 17
case ChipVersion::Version4:
case ChipVersion::Version5:
case ChipVersion::Version6:
- return "RTL8168C/8111C"; // 19, 20, 21, 22
+ return "RTL8168C/8111C"sv; // 19, 20, 21, 22
case ChipVersion::Version7:
case ChipVersion::Version8:
- return "RTL8168CP/8111CP"; // 18, 23, 24
+ return "RTL8168CP/8111CP"sv; // 18, 23, 24
case ChipVersion::Version9:
case ChipVersion::Version10:
- return "RTL8168D/8111D"; // 25, 26
+ return "RTL8168D/8111D"sv; // 25, 26
case ChipVersion::Version11:
case ChipVersion::Version12:
case ChipVersion::Version13:
- return "RTL8168DP/8111DP"; // 27, 28, 31
+ return "RTL8168DP/8111DP"sv; // 27, 28, 31
case ChipVersion::Version14:
case ChipVersion::Version15:
- return "RTL8168E/8111E"; // 32, 33
+ return "RTL8168E/8111E"sv; // 32, 33
case ChipVersion::Version16:
case ChipVersion::Version17:
- return "RTL8168E-VL/8111E-VL"; // 34
+ return "RTL8168E-VL/8111E-VL"sv; // 34
case ChipVersion::Version18:
case ChipVersion::Version19:
- return "RTL8168F/8111F"; // 35, 36
+ return "RTL8168F/8111F"sv; // 35, 36
case ChipVersion::Version20:
return "RTL8411"; // 38
case ChipVersion::Version21:
case ChipVersion::Version22:
- return "RTL8168G/8111G"; // 40, 41, 42
+ return "RTL8168G/8111G"sv; // 40, 41, 42
case ChipVersion::Version23:
case ChipVersion::Version27:
case ChipVersion::Version28:
- return "RTL8168EP/8111EP"; // 49, 50, 51
+ return "RTL8168EP/8111EP"sv; // 49, 50, 51
case ChipVersion::Version24:
case ChipVersion::Version25:
- return "RTL8168GU/8111GU"; // ???
+ return "RTL8168GU/8111GU"sv; // ???
case ChipVersion::Version26:
return "RTL8411B"; // 44
case ChipVersion::Version29:
case ChipVersion::Version30:
- return "RTL8168H/8111H"; // 45, 46
+ return "RTL8168H/8111H"sv; // 45, 46
case ChipVersion::Unknown:
- return "Unknown";
+ return "Unknown"sv;
}
VERIFY_NOT_REACHED();
}
diff --git a/Kernel/Net/RTL8168NetworkAdapter.h b/Kernel/Net/RTL8168NetworkAdapter.h
index 6b65bc3d1b..3c7616ef26 100644
--- a/Kernel/Net/RTL8168NetworkAdapter.h
+++ b/Kernel/Net/RTL8168NetworkAdapter.h
@@ -122,7 +122,7 @@ private:
};
void identify_chip_version();
- String possible_device_name();
+ StringView possible_device_name();
void reset();
void read_mac_address();