提交 54841a06 编写于 作者: T Takashi Iwai

ALSA: seq: Use atomic ops for autoload refcount

... just to robustify for races.
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 bfe01a5b
无相关合并请求
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部