diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-06 14:45:33 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-02-17 07:39:37 +0100 |
commit | 38ebb7034970efe5c7419267e499295e5893b565 (patch) | |
tree | 764a26c230c0c80ef76ec54ffb185b51ae6c5f99 /sound/core | |
parent | b62b998010028c4dfd7db7c26990efb2a0985a1e (diff) | |
download | linux-38ebb7034970efe5c7419267e499295e5893b565.tar.gz linux-38ebb7034970efe5c7419267e499295e5893b565.tar.bz2 linux-38ebb7034970efe5c7419267e499295e5893b565.zip |
ALSA: Consolidate snd_find_free_minor()
A really small cleanup to consolidate snd_find_free_minor() and
snd_kernel_minor() so that we can get rid of one more ifdef.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/sound.c | 14 |
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 = }; #ifdef CONFIG_SND_DYNAMIC_MINORS -static int snd_find_free_minor(int type) +static int snd_find_free_minor(int type, struct snd_card *card, int dev) { int minor; @@ -209,7 +209,7 @@ static int snd_find_free_minor(int type) return -EBUSY; } #else -static int snd_kernel_minor(int type, struct snd_card *card, int dev) +static int snd_find_free_minor(int type, struct snd_card *card, int dev) { int minor; @@ -237,6 +237,8 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev) } if (snd_BUG_ON(minor < 0 || minor >= SNDRV_OS_MINORS)) return -EINVAL; + if (snd_minors[minor]) + return -EBUSY; return minor; } #endif @@ -276,13 +278,7 @@ int snd_register_device(int type, struct snd_card *card, int dev, preg->private_data = private_data; preg->card_ptr = card; mutex_lock(&sound_mutex); -#ifdef CONFIG_SND_DYNAMIC_MINORS - minor = snd_find_free_minor(type); -#else - minor = snd_kernel_minor(type, card, dev); - if (minor >= 0 && snd_minors[minor]) - minor = -EBUSY; -#endif + minor = snd_find_free_minor(type, card, dev); if (minor < 0) { err = minor; goto error; |