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