[RFC PATCH v2 2/4] rust: jump label: add STATIC_KEY_INIT_FALSE

From: Andrew Ballance
Date: Fri Jun 20 2025 - 17:06:35 EST


adds a const STATIC_KEY_INIT_FALSE which should be used to init
a static_key_false.

Signed-off-by: Andrew Ballance <andrewjballance@xxxxxxxxx>
---
rust/kernel/jump_label.rs | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/rust/kernel/jump_label.rs b/rust/kernel/jump_label.rs
index 002cc3bd73da..e30db2d06c76 100644
--- a/rust/kernel/jump_label.rs
+++ b/rust/kernel/jump_label.rs
@@ -72,3 +72,8 @@ macro_rules! arch_static_branch {
pub const fn bool_to_int(b: bool) -> i32 {
b as i32
}
+
+/// Default value for a `static_key_false`.
+// SAFETY: a unlikely static key is always zeroed
+#[allow(dead_code)]
+pub(crate) const STATIC_KEY_INIT_FALSE: bindings::static_key_false = unsafe { core::mem::zeroed() };
--
2.49.0