Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/spinlock.h>
4
5__rust_helper void rust_helper___spin_lock_init(spinlock_t *lock,
6 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
20__rust_helper void rust_helper_spin_lock(spinlock_t *lock)
21{
22 spin_lock(lock);
23}
24
25__rust_helper void rust_helper_spin_unlock(spinlock_t *lock)
26{
27 spin_unlock(lock);
28}
29
30__rust_helper int rust_helper_spin_trylock(spinlock_t *lock)
31{
32 return spin_trylock(lock);
33}
34
35__rust_helper void rust_helper_spin_assert_is_held(spinlock_t *lock)
36{
37 lockdep_assert_held(lock);
38}