xref: /linux/rust/helpers/mutex.c (revision 23b0f90ba871f096474e1c27c3d14f455189d2d9)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/mutex.h>
4 
5 __rust_helper void rust_helper_mutex_lock(struct mutex *lock)
6 {
7 	mutex_lock(lock);
8 }
9 
10 __rust_helper int rust_helper_mutex_trylock(struct mutex *lock)
11 {
12 	return mutex_trylock(lock);
13 }
14 
15 __rust_helper void rust_helper___mutex_init(struct mutex *mutex,
16 					    const char *name,
17 					    struct lock_class_key *key)
18 {
19 	__mutex_init(mutex, name, key);
20 }
21 
22 __rust_helper void rust_helper_mutex_assert_is_held(struct mutex *mutex)
23 {
24 	lockdep_assert_held(mutex);
25 }
26 
27 __rust_helper void rust_helper_mutex_destroy(struct mutex *lock)
28 {
29 	mutex_destroy(lock);
30 }
31