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

Andrew Ballance posted 4 patches 3 months, 2 weeks ago
[RFC PATCH v2 2/4] rust: jump label: add STATIC_KEY_INIT_FALSE
Posted by Andrew Ballance 3 months, 2 weeks ago
adds a const STATIC_KEY_INIT_FALSE which should be used to init
a static_key_false.

Signed-off-by: Andrew Ballance <andrewjballance@gmail.com>
---
 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