aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/sync.c
diff options
context:
space:
mode:
authorMitchell Levy <[email protected]>2025-03-07 23:27:01 +0000
committerIngo Molnar <[email protected]>2025-03-07 23:55:04 +0000
commitf73ca66f0d7f4371d172d6f5b1f9a00e367ba921 (patch)
treef61b0e29525c92a198a8c0ab3389437e000f5b82 /rust/helpers/sync.c
parentrust: sync: condvar: Add wait_interruptible_freezable() (diff)
downloadkernel-f73ca66f0d7f4371d172d6f5b1f9a00e367ba921.tar.gz
kernel-f73ca66f0d7f4371d172d6f5b1f9a00e367ba921.zip
rust: lockdep: Use Pin for all LockClassKey usages
Reintroduce dynamically-allocated LockClassKeys such that they are automatically (de)registered. Require that all usages of LockClassKeys ensure that they are Pin'd. Currently, only `'static` LockClassKeys are supported, so Pin is redundant. However, it is intended that dynamically-allocated LockClassKeys will eventually be supported, so using Pin from the outset will make that change simpler. Closes: https://github.com/Rust-for-Linux/linux/issues/1102 Suggested-by: Benno Lossin <[email protected]> Suggested-by: Boqun Feng <[email protected]> Signed-off-by: Mitchell Levy <[email protected]> Signed-off-by: Boqun Feng <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'rust/helpers/sync.c')
-rw-r--r--rust/helpers/sync.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/rust/helpers/sync.c b/rust/helpers/sync.c
new file mode 100644
index 000000000000..ff7e68b48810
--- /dev/null
+++ b/rust/helpers/sync.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/lockdep.h>
+
+void rust_helper_lockdep_register_key(struct lock_class_key *k)
+{
+ lockdep_register_key(k);
+}
+
+void rust_helper_lockdep_unregister_key(struct lock_class_key *k)
+{
+ lockdep_unregister_key(k);
+}