aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/core/sound.c')
-rw-r--r--sound/core/sound.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 185cec01ee25..5fc93d00572a 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -186,7 +186,7 @@ static const struct file_operations snd_fops =
186}; 186};
187 187
188#ifdef CONFIG_SND_DYNAMIC_MINORS 188#ifdef CONFIG_SND_DYNAMIC_MINORS
189static int snd_find_free_minor(int type) 189static int snd_find_free_minor(int type, struct snd_card *card, int dev)
190{ 190{
191 int minor; 191 int minor;
192 192
@@ -209,7 +209,7 @@ static int snd_find_free_minor(int type)
209 return -EBUSY; 209 return -EBUSY;
210} 210}
211#else 211#else
212static int snd_kernel_minor(int type, struct snd_card *card, int dev) 212static int snd_find_free_minor(int type, struct snd_card *card, int dev)
213{ 213{
214 int minor; 214 int minor;
215 215
@@ -237,6 +237,8 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
237 } 237 }
238 if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OS_MINORS)) 238 if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OS_MINORS))
239 return -EINVAL; 239 return -EINVAL;
240 if (snd_minors[minor])
241 return -EBUSY;
240 return minor; 242 return minor;
241} 243}
242#endif 244#endif
@@ -276,13 +278,7 @@ int snd_register_device(int type, struct snd_card *card, int dev,
276 preg->private_data = private_data; 278 preg->private_data = private_data;
277 preg->card_ptr = card; 279 preg->card_ptr = card;
278 mutex_lock(&sound_mutex); 280 mutex_lock(&sound_mutex);
279#ifdef CONFIG_SND_DYNAMIC_MINORS 281 minor = snd_find_free_minor(type, card, dev);
280 minor = snd_find_free_minor(type);
281#else
282 minor = snd_kernel_minor(type, card, dev);
283 if (minor >= 0 && snd_minors[minor])
284 minor = -EBUSY;
285#endif
286 if (minor < 0) { 282 if (minor < 0) {
287 err = minor; 283 err = minor;
288 goto error; 284 goto error;