From: Miguel Ojeda Date: Fri, 30 Jan 2026 04:25:30 +0000 (+0100) Subject: Merge patch series "Add support for print exactly once" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08afcc38a64cec3d6065b90391afebfde686a69a;p=thirdparty%2Fkernel%2Flinux.git Merge patch series "Add support for print exactly once" Tomonori writes: "This adds the Rust equivalent of the C's DO_ONCE_LITE and pr_*_once macros. A proposal for this feature was made in the past [1], but it didn't reach consensus on the implementation and wasn't merged. Unlike the previous proposal, this implements the C's DO_ONCE_LITE mechanism using a single atomic variable. 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 readability. To make it clear that this feature is intended solely for print-related functionality (just like in C), the implementation is placed in print.rs. If an equivalent of std::sync::Once is needed in the future, it should be based on SetOnce rather than OnceLite. Unlike std::sync::Once and SetOnce, OnceLite only manages two states: incomplete and complete. The do_once_lite macro places the OnceLite object in the .data..once section, which may be zeroed by memset at any time. While this means tear reads might happen, OnceLite only manages two states (zero and non-zero), so no actual problem occurs in practice. OnceLite currently uses Atomic, but may be changed to use Atomic [2] when it becomes available." Link: https://lore.kernel.org/rust-for-linux/20241126-pr_once_macros-v4-0-410b8ca9643e@tuta.io/ [1] Link: https://lore.kernel.org/rust-for-linux/20251115050305.3872412-1-fujita.tomonori@gmail.com/ [2] Link: https://patch.msgid.link/20251117002452.4068692-1-fujita.tomonori@gmail.com Signed-off-by: Miguel Ojeda --- 08afcc38a64cec3d6065b90391afebfde686a69a