aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 18:16:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-01-31 18:16:28 -0500
commite1a9c9872dd004617555dff079b357a6ffd945e9 (patch)
treec34779e59712ff345f8e4ee97e74086a85b34974 /sound/core/init.c
parentfcc3ff4f9d695a80dc6e6058e0d631a3026ed4c3 (diff)
parent2ecba4ffbbc6c85fce8c3878514be415edace413 (diff)
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa: (299 commits) [ALSA] version 1.0.16rc2 [ALSA] hda: fix Mic in as output [ALSA] emu10k1 - Another EMU0404 Board ID [ALSA] emu10k1 - Fix kthread handling at resume [ALSA] emu10k1: General cleanup, add new locks, fix alsa bug#3501, kernel bug#9304. [ALSA] emu10k1 - Use enum for emu_model types [ALSA] emu10k1 - Don't create emu1010 controls for non-emu boards [ALSA] emu10k1 - 1616(M) cardbus improvements [ALSA] snd:emu10k1: E-Mu updates. Fixes to firmware loading and support for 0404. [ALSA] emu10k1: Add comments regarding E-Mu ins and outs. [ALSA] oxygen: revert SPI clock frequency change for AK4396/WM8785 [ALSA] es1938 - improve capture hw pointer reads [ALSA] HDA-Intel - Add support for Intel SCH [ALSA] hda: Add GPIO mute support to STAC9205 [ALSA] hda-codec - Add Dell T3400 support [ALSA] hda-codec - Add model for HP DV9553EG laptop [ALSA] hda-codec - Control SPDIF as slave [ALSA] hda_intel: ALSA HD Audio patch for Intel ICH10 DeviceID's [ALSA] Fix Oops with PCM OSS sync [ALSA] hda-codec - Add speaker automute to ALC262 HP models ...
Diffstat (limited to 'sound/core/init.c')
-rw-r--r--sound/core/init.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index 2cb7099eb1e1..e3338d6071ef 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <sound/driver.h>
23#include <linux/init.h> 22#include <linux/init.h>
24#include <linux/sched.h> 23#include <linux/sched.h>
25#include <linux/file.h> 24#include <linux/file.h>
@@ -43,6 +42,40 @@ EXPORT_SYMBOL(snd_cards);
43 42
44static DEFINE_MUTEX(snd_card_mutex); 43static DEFINE_MUTEX(snd_card_mutex);
45 44
45static char *slots[SNDRV_CARDS];
46module_param_array(slots, charp, NULL, 0444);
47MODULE_PARM_DESC(slots, "Module names assigned to the slots.");
48
49/* return non-zero if the given index is already reserved for another
50 * module via slots option
51 */
52static int module_slot_mismatch(struct module *module, int idx)
53{
54#ifdef MODULE
55 char *s1, *s2;
56 if (!module || !module->name || !slots[idx])
57 return 0;
58 s1 = slots[idx];
59 s2 = module->name;
60 /* compare module name strings
61 * hyphens are handled as equivalent with underscore
62 */
63 for (;;) {
64 char c1 = *s1++;
65 char c2 = *s2++;
66 if (c1 == '-')
67 c1 = '_';
68 if (c2 == '-')
69 c2 = '_';
70 if (c1 != c2)
71 return 1;
72 if (!c1)
73 break;
74 }
75#endif
76 return 0;
77}
78
46#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 79#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
47int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag); 80int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
48EXPORT_SYMBOL(snd_mixer_oss_notify_callback); 81EXPORT_SYMBOL(snd_mixer_oss_notify_callback);
@@ -115,6 +148,8 @@ struct snd_card *snd_card_new(int idx, const char *xid,
115 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) 148 for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++)
116 /* idx == -1 == 0xffff means: take any free slot */ 149 /* idx == -1 == 0xffff means: take any free slot */
117 if (~snd_cards_lock & idx & 1<<idx2) { 150 if (~snd_cards_lock & idx & 1<<idx2) {
151 if (module_slot_mismatch(module, idx2))
152 continue;
118 idx = idx2; 153 idx = idx2;
119 if (idx >= snd_ecards_limit) 154 if (idx >= snd_ecards_limit)
120 snd_ecards_limit = idx + 1; 155 snd_ecards_limit = idx + 1;
@@ -304,8 +339,8 @@ int snd_card_disconnect(struct snd_card *card)
304 list_add(&mfile->shutdown_list, &shutdown_files); 339 list_add(&mfile->shutdown_list, &shutdown_files);
305 spin_unlock(&shutdown_lock); 340 spin_unlock(&shutdown_lock);
306 341
307 fops_get(&snd_shutdown_f_ops);
308 mfile->file->f_op = &snd_shutdown_f_ops; 342 mfile->file->f_op = &snd_shutdown_f_ops;
343 fops_get(mfile->file->f_op);
309 344
310 mfile = mfile->next; 345 mfile = mfile->next;
311 } 346 }