Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / rust / helpers / spinlock.c
blob5971fdf6f75507e89eb592b5c00c7615988c8f28
1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/spinlock.h>
5 void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
6 struct lock_class_key *key)
8 #ifdef CONFIG_DEBUG_SPINLOCK
9 # if defined(CONFIG_PREEMPT_RT)
10 __spin_lock_init(lock, name, key, false);
11 # else /*!CONFIG_PREEMPT_RT */
12 __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
13 # endif /* CONFIG_PREEMPT_RT */
14 #else /* !CONFIG_DEBUG_SPINLOCK */
15 spin_lock_init(lock);
16 #endif /* CONFIG_DEBUG_SPINLOCK */
19 void rust_helper_spin_lock(spinlock_t *lock)
21 spin_lock(lock);
24 void rust_helper_spin_unlock(spinlock_t *lock)
26 spin_unlock(lock);
29 int rust_helper_spin_trylock(spinlock_t *lock)
31 return spin_trylock(lock);