summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-10-15 14:00:16 +0200
committerTakashi Iwai <tiwai@suse.de>2014-10-15 14:00:16 +0200
commit54841a06c54eb55918948c12ab9b5f02cacb6ab3 (patch)
treee2efd5a9e66c2e338d71690a0aac5deb21870ab1 /sound/core
parentbfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff)
downloadblackbird-op-linux-54841a06c54eb55918948c12ab9b5f02cacb6ab3.tar.gz
blackbird-op-linux-54841a06c54eb55918948c12ab9b5f02cacb6ab3.zip
ALSA: seq: Use atomic ops for autoload refcount
... just to robustify for races. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/seq/seq_device.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 91a786a783e1..775ea9390110 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -127,15 +127,15 @@ static void snd_seq_device_info(struct snd_info_entry *entry,
#ifdef CONFIG_MODULES
/* avoid auto-loading during module_init() */
-static int snd_seq_in_init;
+static atomic_t snd_seq_in_init = ATOMIC_INIT(0);
void snd_seq_autoload_lock(void)
{
- snd_seq_in_init++;
+ atomic_inc(&snd_seq_in_init);
}
void snd_seq_autoload_unlock(void)
{
- snd_seq_in_init--;
+ atomic_dec(&snd_seq_in_init);
}
#endif
@@ -147,7 +147,7 @@ void snd_seq_device_load_drivers(void)
/* Calling request_module during module_init()
* may cause blocking.
*/
- if (snd_seq_in_init)
+ if (atomic_read(&snd_seq_in_init))
return;
mutex_lock(&ops_mutex);
OpenPOWER on IntegriCloud