Skip to content

Commit

Permalink
ALSA: seq: Enable 'use' locking in all configurations
Browse files Browse the repository at this point in the history
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: [email protected]
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
bwh-ct authored and tiwai committed Oct 18, 2017
1 parent 9bb201a commit 8009d50
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions sound/core/seq/seq_lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <sound/core.h>
#include "seq_lock.h"

#if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)

/* wait until all locks are released */
void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
{
Expand All @@ -41,5 +39,3 @@ void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
}
}
EXPORT_SYMBOL(snd_use_lock_sync_helper);

#endif
12 changes: 0 additions & 12 deletions sound/core/seq/seq_lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <linux/sched.h>

#if defined(CONFIG_SMP) || defined(CONFIG_SND_DEBUG)

typedef atomic_t snd_use_lock_t;

/* initialize lock */
Expand All @@ -20,14 +18,4 @@ typedef atomic_t snd_use_lock_t;
void snd_use_lock_sync_helper(snd_use_lock_t *lock, const char *file, int line);
#define snd_use_lock_sync(lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__)

#else /* SMP || CONFIG_SND_DEBUG */

typedef spinlock_t snd_use_lock_t; /* dummy */
#define snd_use_lock_init(lockp) /**/
#define snd_use_lock_use(lockp) /**/
#define snd_use_lock_free(lockp) /**/
#define snd_use_lock_sync(lockp) /**/

#endif /* SMP || CONFIG_SND_DEBUG */

#endif /* __SND_SEQ_LOCK_H */

0 comments on commit 8009d50

Please sign in to comment.