TTY: ldisc, do not close until there are readers
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / sound / core / seq / seq_lock.h
blob54044bc2c9ef24892a7e6747dcd67e92fb01b0f1
1 #ifndef __SND_SEQ_LOCK_H
2 #define __SND_SEQ_LOCK_H
4 #include <linux/sched.h>
6 #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)
8 typedef atomic_t snd_use_lock_t;
10 /* initialize lock */
11 #define snd_use_lock_init(lockp) atomic_set(lockp, 0)
13 /* increment lock */
14 #define snd_use_lock_use(lockp) atomic_inc(lockp)
16 /* release lock */
17 #define snd_use_lock_free(lockp) atomic_dec(lockp)
19 /* wait until all locks are released */
20 void 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__)
23 #else /* SMP || CONFIG_SND_DEBUG */
25 typedef 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) /**/
31 #endif /* SMP || CONFIG_SND_DEBUG */
33 #endif /* __SND_SEQ_LOCK_H */