]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: print: Add support for calling a function exactly once
authorFUJITA Tomonori <fujita.tomonori@gmail.com>
Mon, 17 Nov 2025 00:24:51 +0000 (09:24 +0900)
committerMiguel Ojeda <ojeda@kernel.org>
Fri, 30 Jan 2026 04:18:17 +0000 (05:18 +0100)
commite600425708148e952adce496ac9e9def79264c8a
tree5a4bcd6896aa285d6d92c17323267003a42b38d2
parent966f79ce6f6b3d138b69cacc3cdcbb5001141b4d
rust: print: Add support for calling a function exactly once

Add the Rust equivalent of the kernel's `DO_ONCE_LITE` macro. While it
would be possible to implement the feature entirely as a Rust macro,
the functionality that can be implemented as regular functions has
been extracted and implemented as the `OnceLite` struct for better
code maintainability.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20251117002452.4068692-2-fujita.tomonori@gmail.com
[ Added prefix to title. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/print.rs