summaryrefslogtreecommitdiff
path: root/Kernel/Storage
diff options
context:
space:
mode:
authorLenny Maiorani <lenny@serenityos.org>2022-02-09 11:33:39 -0700
committerLinus Groh <mail@linusgroh.de>2022-02-09 21:04:51 +0000
commitc6acf645589cd96b9e25ab9f9da41ca2ae3721b4 (patch)
treece5da59df32cbb23787d4ea11f9742e695cb73c3 /Kernel/Storage
parent6a4c8a66aeba4b6ed0a91f2f0e9b7da42fe2b06f (diff)
downloadserenity-c6acf645589cd96b9e25ab9f9da41ca2ae3721b4.zip
Kernel: Change static constexpr variables to constexpr where possible
Function-local `static constexpr` variables can be `constexpr`. This can reduce memory consumption, binary size, and offer additional compiler optimizations. These changes result in a stripped x86_64 kernel binary size reduction of 592 bytes.
Diffstat (limited to 'Kernel/Storage')
-rw-r--r--Kernel/Storage/NVMe/NVMeController.cpp3
-rw-r--r--Kernel/Storage/StorageManagement.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Storage/NVMe/NVMeController.cpp b/Kernel/Storage/NVMe/NVMeController.cpp
index aab71dece3..e1ea8ac8b9 100644
--- a/Kernel/Storage/NVMe/NVMeController.cpp
+++ b/Kernel/Storage/NVMe/NVMeController.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2021, Pankaj R <pankydev8@gmail.com>
+ * Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -71,7 +72,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::initialize(bool is_queue_polled)
bool NVMeController::wait_for_ready(bool expected_ready_bit_value)
{
- static constexpr size_t one_ms_io_delay = 1000;
+ constexpr size_t one_ms_io_delay = 1000;
auto wait_iterations = m_ready_timeout.to_milliseconds();
u32 expected_rdy = expected_ready_bit_value ? 1 : 0;
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp
index 1b67a2febd..f30f6a5a19 100644
--- a/Kernel/Storage/StorageManagement.cpp
+++ b/Kernel/Storage/StorageManagement.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
+ * Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -57,7 +58,7 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio, b
}
{
- static constexpr PCI::HardwareID vmd_device = { 0x8086, 0x9a0b };
+ constexpr PCI::HardwareID vmd_device = { 0x8086, 0x9a0b };
if (device_identifier.hardware_id() == vmd_device) {
auto controller = PCI::VolumeManagementDevice::must_create(device_identifier);
PCI::Access::the().add_host_controller_and_enumerate_attached_devices(move(controller), [this, nvme_poll](PCI::DeviceIdentifier const& device_identifier) -> void {