aboutsummaryrefslogtreecommitdiffstats
path: root/rust/helpers/mutex.c
diff options
context:
space:
mode:
authorPaolo Bonzini <[email protected]>2025-05-28 08:34:30 +0000
committerPaolo Bonzini <[email protected]>2025-05-28 10:28:30 +0000
commit4dbe28c0fabd69842890ba38f185b96664cba26a (patch)
tree897e71ba816c4687c79ea0d30ac85975dc90dfd0 /rust/helpers/mutex.c
parentRISC-V: KVM: use kvm_trylock_all_vcpus when locking all vCPUs (diff)
downloadkernel-4dbe28c0fabd69842890ba38f185b96664cba26a.tar.gz
kernel-4dbe28c0fabd69842890ba38f185b96664cba26a.zip
rust: add helper for mutex_trylock
After commit c5b6ababd21a ("locking/mutex: implement mutex_trylock_nested", currently in the KVM tree) mutex_trylock() will be a macro when lockdep is enabled. Rust therefore needs the corresponding helper. Just add it and the rust/bindings/bindings_helpers_generated.rs Makefile rules will do their thing. Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> Message-ID: <[email protected]> Acked-by: Miguel Ojeda <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
Diffstat (limited to 'rust/helpers/mutex.c')
-rw-r--r--rust/helpers/mutex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/rust/helpers/mutex.c b/rust/helpers/mutex.c
index 06575553eda5..9ab29104bee1 100644
--- a/rust/helpers/mutex.c
+++ b/rust/helpers/mutex.c
@@ -7,6 +7,11 @@ void rust_helper_mutex_lock(struct mutex *lock)
mutex_lock(lock);
}
+int rust_helper_mutex_trylock(struct mutex *lock)
+{
+ return mutex_trylock(lock);
+}
+
void rust_helper___mutex_init(struct mutex *mutex, const char *name,
struct lock_class_key *key)
{