diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2017-10-17 19:45:49 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-10-18 02:01:46 -0400 |
commit | 8009d506a1dd00cf436b0c4cca0dcec130580a21 (patch) | |
tree | 209ca105955d913807eb48c6246f275b63c42e50 | |
parent | 9bb201a5d5acc733943e8af7151cceab9d976a69 (diff) |
ALSA: seq: Enable 'use' locking in all configurations
The 'use' locking macros are no-ops if neither SMP or SND_DEBUG is
enabled. This might once have been OK in non-preemptible
configurations, but even in that case snd_seq_read() may sleep while
relying on a 'use' lock. So always use the proper implementations.
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/core/seq/seq_lock.c | 4 | ||||
-rw-r--r-- | sound/core/seq/seq_lock.h | 12 |
2 files changed, 0 insertions, 16 deletions
diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c index 0ff7926a5a69..cda64b489e42 100644 --- a/sound/core/seq/seq_lock.c +++ b/sound/core/seq/seq_lock.c | |||
@@ -23,8 +23,6 @@ | |||
23 | #include <sound/core.h> | 23 | #include <sound/core.h> |
24 | #include "seq_lock.h" | 24 | #include "seq_lock.h" |
25 | 25 | ||
26 | #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG) | ||
27 | |||
28 | /* wait until all locks are released */ | 26 | /* wait until all locks are released */ |
29 | void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) | 27 | void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) |
30 | { | 28 | { |
@@ -41,5 +39,3 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line) | |||
41 | } | 39 | } |
42 | } | 40 | } |
43 | EXPORT_SYMBOL(snd_use_lock_sync_helper); | 41 | EXPORT_SYMBOL(snd_use_lock_sync_helper); |
44 | |||
45 | #endif | ||
diff --git a/sound/core/seq/seq_lock.h b/sound/core/seq/seq_lock.h index 54044bc2c9ef..ac38031c370e 100644 --- a/sound/core/seq/seq_lock.h +++ b/sound/core/seq/seq_lock.h | |||
@@ -3,8 +3,6 @@ | |||
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | 5 | ||
6 | #if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG) | ||
7 | |||
8 | typedef atomic_t snd_use_lock_t; | 6 | typedef atomic_t snd_use_lock_t; |
9 | 7 | ||
10 | /* initialize lock */ | 8 | /* initialize lock */ |
@@ -20,14 +18,4 @@ typedef atomic_t snd_use_lock_t; | |||
20 | void snd_use_lock_sync_helper(snd_use_lock_t *lock, const char *file, int line); | 18 | 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__) | 19 | #define snd_use_lock_sync(lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__) |
22 | 20 | ||
23 | #else /* SMP || CONFIG_SND_DEBUG */ | ||
24 | |||
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) /**/ | ||
30 | |||
31 | #endif /* SMP || CONFIG_SND_DEBUG */ | ||
32 | |||
33 | #endif /* __SND_SEQ_LOCK_H */ | 21 | #endif /* __SND_SEQ_LOCK_H */ |