diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-15 08:00:16 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-15 08:00:16 -0400 |
commit | 54841a06c54eb55918948c12ab9b5f02cacb6ab3 (patch) | |
tree | e2efd5a9e66c2e338d71690a0aac5deb21870ab1 /sound/core | |
parent | bfe01a5ba2490f299e1d2d5508cbbbadd897bbe9 (diff) |
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.c | 8 |
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, | |||
127 | 127 | ||
128 | #ifdef CONFIG_MODULES | 128 | #ifdef CONFIG_MODULES |
129 | /* avoid auto-loading during module_init() */ | 129 | /* avoid auto-loading during module_init() */ |
130 | static int snd_seq_in_init; | 130 | static atomic_t snd_seq_in_init = ATOMIC_INIT(0); |
131 | void snd_seq_autoload_lock(void) | 131 | void snd_seq_autoload_lock(void) |
132 | { | 132 | { |
133 | snd_seq_in_init++; | 133 | atomic_inc(&snd_seq_in_init); |
134 | } | 134 | } |
135 | 135 | ||
136 | void snd_seq_autoload_unlock(void) | 136 | void snd_seq_autoload_unlock(void) |
137 | { | 137 | { |
138 | snd_seq_in_init--; | 138 | atomic_dec(&snd_seq_in_init); |
139 | } | 139 | } |
140 | #endif | 140 | #endif |
141 | 141 | ||
@@ -147,7 +147,7 @@ void snd_seq_device_load_drivers(void) | |||
147 | /* Calling request_module during module_init() | 147 | /* Calling request_module during module_init() |
148 | * may cause blocking. | 148 | * may cause blocking. |
149 | */ | 149 | */ |
150 | if (snd_seq_in_init) | 150 | if (atomic_read(&snd_seq_in_init)) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | mutex_lock(&ops_mutex); | 153 | mutex_lock(&ops_mutex); |