summaryrefslogtreecommitdiff
path: root/rust/kernel/sync/lock
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2026-10-07 14:30:03 +0000
committerMiguel Ojeda <ojeda@kernel.org>2026-10-12 07:03:26 +0200
commitecdfcc7f2974c368fb932b16dd3c2deb4a8cbdb0 (patch)
treecdd244960f7d08ab9a5b023f900a6ae9b3c17613 /rust/kernel/sync/lock
parent107a25d62c40ef47b2284ee37fdefc1d3f5d013b (diff)
downloadlinux-next-ecdfcc7f2974c368fb932b16dd3c2deb4a8cbdb0.tar.gz
linux-next-ecdfcc7f2974c368fb932b16dd3c2deb4a8cbdb0.zip
rust: add pr_*_ratelimited! macros for printing
Printing can be very expensive if it occurs often, so printing that can be triggered by userspace should be rate limited. For this purpose, add a Rust wrapper around `struct ratelimit_state` and use it in the new macros. The new files will fall under the catch-all RUST maintainers entry. Tested-by: Alvin Sun <alvin.sun@linux.dev> Reviewed-by: Carlos Llamas <cmllamas@google.com> Link: https://github.com/Rust-for-Linux/linux/issues/122 Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-3-f14accd4ea3b@google.com [ Removed unused link reference definitions. On the `static`, allowed the `non_upper_case_globals` lint so that `kernel` users (and users providing their own name) do not warn. Reworded title for typo. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/kernel/sync/lock')
-rw-r--r--rust/kernel/sync/lock/spinlock.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spinlock.rs
index 037fa63ebcac..6a71bb3a5c45 100644
--- a/rust/kernel/sync/lock/spinlock.rs
+++ b/rust/kernel/sync/lock/spinlock.rs
@@ -468,7 +468,6 @@ mod tests {
///
/// For use in statics containing raw spinlocks.
#[doc(alias("__SPIN_LOCK_UNLOCKED", "DEFINE_SPINLOCK"))]
-#[expect(dead_code)]
pub(crate) const fn raw_spin_lock_unlocked(name: &'static CStr) -> bindings::raw_spinlock_t {
// Silence unused variable warnings.
#[cfg(not(CONFIG_DEBUG_LOCK_ALLOC))]