diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-11-20 08:09:05 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:29:21 -0500 |
commit | d001544ded23ddb1116f945ccc2d89a7f98ab7e8 (patch) | |
tree | 721fbc6355acfb886817e2b120f198383c5e6ae6 /sound/core/init.c | |
parent | 204bdb1b50013c7aa3922d8b66df943123087bd8 (diff) |
[ALSA] dynamic minors (6/6): increase maximum number of sound cards
Modules: ALSA Core,Memalloc module,ALSA sequencer
With dynamic minor numbers, we can increase the number of sound cards.
This requires that the sequencer client numbers of some kernel drivers
are allocated dynamically, too.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/core/init.c')
-rw-r--r-- | sound/core/init.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/core/init.c b/sound/core/init.c index 728bb2ce0bc7..58e17d385f8d 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -338,7 +338,7 @@ int snd_card_free_in_thread(struct snd_card *card) | |||
338 | 338 | ||
339 | static void choose_default_id(struct snd_card *card) | 339 | static void choose_default_id(struct snd_card *card) |
340 | { | 340 | { |
341 | int i, len, idx_flag = 0, loops = 8; | 341 | int i, len, idx_flag = 0, loops = SNDRV_CARDS; |
342 | char *id, *spos; | 342 | char *id, *spos; |
343 | 343 | ||
344 | id = spos = card->shortname; | 344 | id = spos = card->shortname; |
@@ -380,9 +380,12 @@ static void choose_default_id(struct snd_card *card) | |||
380 | 380 | ||
381 | __change: | 381 | __change: |
382 | len = strlen(id); | 382 | len = strlen(id); |
383 | if (idx_flag) | 383 | if (idx_flag) { |
384 | id[len-1]++; | 384 | if (id[len-1] != '9') |
385 | else if ((size_t)len <= sizeof(card->id) - 3) { | 385 | id[len-1]++; |
386 | else | ||
387 | id[len-1] = 'A'; | ||
388 | } else if ((size_t)len <= sizeof(card->id) - 3) { | ||
386 | strcat(id, "_1"); | 389 | strcat(id, "_1"); |
387 | idx_flag++; | 390 | idx_flag++; |
388 | } else { | 391 | } else { |
@@ -461,12 +464,12 @@ static void snd_card_info_read(struct snd_info_entry *entry, | |||
461 | read_lock(&snd_card_rwlock); | 464 | read_lock(&snd_card_rwlock); |
462 | if ((card = snd_cards[idx]) != NULL) { | 465 | if ((card = snd_cards[idx]) != NULL) { |
463 | count++; | 466 | count++; |
464 | snd_iprintf(buffer, "%i [%-15s]: %s - %s\n", | 467 | snd_iprintf(buffer, "%2i [%-15s]: %s - %s\n", |
465 | idx, | 468 | idx, |
466 | card->id, | 469 | card->id, |
467 | card->driver, | 470 | card->driver, |
468 | card->shortname); | 471 | card->shortname); |
469 | snd_iprintf(buffer, " %s\n", | 472 | snd_iprintf(buffer, " %s\n", |
470 | card->longname); | 473 | card->longname); |
471 | } | 474 | } |
472 | read_unlock(&snd_card_rwlock); | 475 | read_unlock(&snd_card_rwlock); |
@@ -508,7 +511,8 @@ static void snd_card_module_info_read(struct snd_info_entry *entry, | |||
508 | for (idx = 0; idx < SNDRV_CARDS; idx++) { | 511 | for (idx = 0; idx < SNDRV_CARDS; idx++) { |
509 | read_lock(&snd_card_rwlock); | 512 | read_lock(&snd_card_rwlock); |
510 | if ((card = snd_cards[idx]) != NULL) | 513 | if ((card = snd_cards[idx]) != NULL) |
511 | snd_iprintf(buffer, "%i %s\n", idx, card->module->name); | 514 | snd_iprintf(buffer, "%2i %s\n", |
515 | idx, card->module->name); | ||
512 | read_unlock(&snd_card_rwlock); | 516 | read_unlock(&snd_card_rwlock); |
513 | } | 517 | } |
514 | } | 518 | } |