blob: 54044bc2c9ef24892a7e6747dcd67e92fb01b0f1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __SND_SEQ_LOCK_H
2#define __SND_SEQ_LOCK_H
3
4#include <linux/sched.h>
5
6#if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
7
8typedef atomic_t snd_use_lock_t;
9
10/* initialize lock */
11#define snd_use_lock_init(lockp) atomic_set(lockp, 0)
12
13/* increment lock */
14#define snd_use_lock_use(lockp) atomic_inc(lockp)
15
16/* release lock */
17#define snd_use_lock_free(lockp) atomic_dec(lockp)
18
19/* wait until all locks are released */
20void snd_use_lock_sync_helper(snd_use_lock_t *lock, const char *file, int line);
21#define snd_use_lock_sync(lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__)
22
23#else /* SMP || CONFIG_SND_DEBUG */
24
25typedef spinlock_t snd_use_lock_t; /* dummy */
26#define snd_use_lock_init(lockp) /**/
27#define snd_use_lock_use(lockp) /**/
28#define snd_use_lock_free(lockp) /**/
29#define snd_use_lock_sync(lockp) /**/
30
31#endif /* SMP || CONFIG_SND_DEBUG */
32
33#endif /* __SND_SEQ_LOCK_H */