xref: /linux/sound/core/seq/seq_lock.h (revision f2ecc3d0787e05d9145722feed01d4a11ab6bec1)
1 #ifndef __SND_SEQ_LOCK_H
2 #define __SND_SEQ_LOCK_H
3 
4 #include <linux/sched.h>
5 
6 typedef atomic_t snd_use_lock_t;
7 
8 /* initialize lock */
9 #define snd_use_lock_init(lockp) atomic_set(lockp, 0)
10 
11 /* increment lock */
12 #define snd_use_lock_use(lockp) atomic_inc(lockp)
13 
14 /* release lock */
15 #define snd_use_lock_free(lockp) atomic_dec(lockp)
16 
17 /* wait until all locks are released */
18 void snd_use_lock_sync_helper(snd_use_lock_t *lock, const char *file, int line);
19 #define snd_use_lock_sync(lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__)
20 
21 #endif /* __SND_SEQ_LOCK_H */
22