• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/export.h>
4 #include <linux/spinlock.h>
5 
rust_helper___spin_lock_init(spinlock_t * lock,const char * name,struct lock_class_key * key)6 void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
7 				  struct lock_class_key *key)
8 {
9 #ifdef CONFIG_DEBUG_SPINLOCK
10 # if defined(CONFIG_PREEMPT_RT)
11 	__spin_lock_init(lock, name, key, false);
12 # else /*!CONFIG_PREEMPT_RT */
13 	__raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
14 # endif /* CONFIG_PREEMPT_RT */
15 #else /* !CONFIG_DEBUG_SPINLOCK */
16 	spin_lock_init(lock);
17 #endif /* CONFIG_DEBUG_SPINLOCK */
18 }
19 
rust_helper_spin_lock(spinlock_t * lock)20 void rust_helper_spin_lock(spinlock_t *lock)
21 {
22 	spin_lock(lock);
23 }
24 
rust_helper_spin_unlock(spinlock_t * lock)25 void rust_helper_spin_unlock(spinlock_t *lock)
26 {
27 	spin_unlock(lock);
28 }
29 
rust_helper_spin_trylock(spinlock_t * lock)30 int rust_helper_spin_trylock(spinlock_t *lock)
31 {
32 	return spin_trylock(lock);
33 }
34