seq_lock.h 901 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef __SND_SEQ_LOCK_H
  2. #define __SND_SEQ_LOCK_H
  3. #include <linux/sched.h>
  4. #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
  5. typedef atomic_t snd_use_lock_t;
  6. /* initialize lock */
  7. #define snd_use_lock_init(lockp) atomic_set(lockp, 0)
  8. /* increment lock */
  9. #define snd_use_lock_use(lockp) atomic_inc(lockp)
  10. /* release lock */
  11. #define snd_use_lock_free(lockp) atomic_dec(lockp)
  12. /* wait until all locks are released */
  13. void snd_use_lock_sync_helper(snd_use_lock_t *lock, const char *file, int line);
  14. #define snd_use_lock_sync(lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__)
  15. #else /* SMP || CONFIG_SND_DEBUG */
  16. typedef spinlock_t snd_use_lock_t; /* dummy */
  17. #define snd_use_lock_init(lockp) /**/
  18. #define snd_use_lock_use(lockp) /**/
  19. #define snd_use_lock_free(lockp) /**/
  20. #define snd_use_lock_sync(lockp) /**/
  21. #endif /* SMP || CONFIG_SND_DEBUG */
  22. #endif /* __SND_SEQ_LOCK_H */