Browse Source

ALSA: core: Add module param array to exclude card slots from automatic assignment

Via slots_reserved module param array one can specify which card slots
should not be considered when assigning card slots automatically.
These reserved slots can only be taken if a card driver specifically
requests the slot via snd_card_create().

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Peter Ujfalusi 10 years ago
parent
commit
a659ab8b62
1 changed files with 5 additions and 1 deletions
  1. 5 1
      sound/core/init.c

+ 5 - 1
sound/core/init.c

@@ -58,6 +58,10 @@ static char *slots[SNDRV_CARDS];
 module_param_array(slots, charp, NULL, 0444);
 MODULE_PARM_DESC(slots, "Module names assigned to the slots.");
 
+static bool slots_reserved[SNDRV_CARDS];
+module_param_array(slots_reserved, bool, NULL, 0444);
+MODULE_PARM_DESC(slots_reserved, "Slots which are excluded from automatic assignment");
+
 /* return non-zero if the given index is reserved for the given
  * module via slots option
  */
@@ -142,7 +146,7 @@ static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
 	for (slot = 0; slot < SNDRV_CARDS; slot++) {
 		if (slot < 32 && !(mask & (1U << slot)))
 			continue;
-		if (!test_bit(slot, snd_cards_lock)) {
+		if (!test_bit(slot, snd_cards_lock) && !slots_reserved[slot]) {
 			if (check(module, slot))
 				return slot; /* found */
 		}