ALSA: seq: Use atomic ops for autoload refcount
... just to robustify for races. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
bfe01a5ba2
commit
54841a06c5
1 changed files with 4 additions and 4 deletions
|
@ -127,15 +127,15 @@ static void snd_seq_device_info(struct snd_info_entry *entry,
|
||||||
|
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
/* avoid auto-loading during module_init() */
|
/* 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)
|
void snd_seq_autoload_lock(void)
|
||||||
{
|
{
|
||||||
snd_seq_in_init++;
|
atomic_inc(&snd_seq_in_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
void snd_seq_autoload_unlock(void)
|
void snd_seq_autoload_unlock(void)
|
||||||
{
|
{
|
||||||
snd_seq_in_init--;
|
atomic_dec(&snd_seq_in_init);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ void snd_seq_device_load_drivers(void)
|
||||||
/* Calling request_module during module_init()
|
/* Calling request_module during module_init()
|
||||||
* may cause blocking.
|
* may cause blocking.
|
||||||
*/
|
*/
|
||||||
if (snd_seq_in_init)
|
if (atomic_read(&snd_seq_in_init))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_lock(&ops_mutex);
|
mutex_lock(&ops_mutex);
|
||||||
|
|
Loading…
Add table
Reference in a new issue