spinlock.c 672 B

12345678910111213141516171819202122232425262728
  1. // SPDX-License-Identifier: GPL-2.0
  2. #include <linux/export.h>
  3. #include <linux/spinlock.h>
  4. void rust_helper___spin_lock_init(spinlock_t *lock, const char *name,
  5. struct lock_class_key *key)
  6. {
  7. #ifdef CONFIG_DEBUG_SPINLOCK
  8. # if defined(CONFIG_PREEMPT_RT)
  9. __spin_lock_init(lock, name, key, false);
  10. # else /*!CONFIG_PREEMPT_RT */
  11. __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
  12. # endif /* CONFIG_PREEMPT_RT */
  13. #else /* !CONFIG_DEBUG_SPINLOCK */
  14. spin_lock_init(lock);
  15. #endif /* CONFIG_DEBUG_SPINLOCK */
  16. }
  17. void rust_helper_spin_lock(spinlock_t *lock)
  18. {
  19. spin_lock(lock);
  20. }
  21. void rust_helper_spin_unlock(spinlock_t *lock)
  22. {
  23. spin_unlock(lock);
  24. }