summaryrefslogtreecommitdiff
path: root/rust/kernel/sync/lockdep.rs
AgeCommit message (Collapse)Author
10 daysrust: sync: add const constructor for raw_spinlock_tAlice Ryhl
The abstractions for pr_*_ratelimited! need to construct a global `struct ratelimit_state`, which contains a `raw_spinlock_t` field. Thus, add a const constructor for the `raw_spinlock_t` type. The SPINLOCK_OWNER_INIT constant isn't mirrored via a const helper because bindgen generates a 'static mut' instead of a constant from the pointer constant., The __ARCH_SPIN_LOCK_UNLOCKED constant cannot be translated by bindgen because it's a define for a struct without type annotations, so it's explicitly declared in Rust. Reviewed-by: Boqun Feng <boqun@kernel.org> Reviewed-by: Carlos Llamas <cmllamas@google.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-2-f14accd4ea3b@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
10 daysrust: sync: move lockdep types to rust/kernel/sync/lockdep.rsAlice Ryhl
The lockdep types are currently stored directly in rust/kernel/sync.rs, but there are starting to be too many of them to keep them in that file. Thus, move them to a submodule. The new module is listed under LOCKING PRIMITIVES in the MAINTAINERS file. For commonly used lockdep logic it's useful to keep re-exports in kernel::sync, and this also avoids the need to update any users. Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Boqun Feng <boqun@kernel.org> Reviewed-by: Carlos Llamas <cmllamas@google.com> Acked-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20261007-pr-ratelimited-v6-1-f14accd4ea3b@google.com [ Used the "kernel vertical" imports style. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>