aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/driver.h7
-rw-r--r--sound/core/init.c18
-rw-r--r--sound/core/memalloc.c4
-rw-r--r--sound/core/seq/seq_clientmgr.c31
-rw-r--r--sound/core/sound.c6
-rw-r--r--sound/core/sound_oss.c4
6 files changed, 49 insertions, 21 deletions
diff --git a/include/sound/driver.h b/include/sound/driver.h
index 3f0416ac24d9..89c6a73f3920 100644
--- a/include/sound/driver.h
+++ b/include/sound/driver.h
@@ -28,7 +28,12 @@
28 28
29#include <linux/config.h> 29#include <linux/config.h>
30 30
31#define SNDRV_CARDS 8 /* number of supported soundcards - don't change - minor numbers */ 31/* number of supported soundcards */
32#ifdef CONFIG_SND_DYNAMIC_MINORS
33#define SNDRV_CARDS 32
34#else
35#define SNDRV_CARDS 8 /* don't change - minor numbers */
36#endif
32 37
33#ifndef CONFIG_SND_MAJOR /* standard configuration */ 38#ifndef CONFIG_SND_MAJOR /* standard configuration */
34#define CONFIG_SND_MAJOR 116 39#define CONFIG_SND_MAJOR 116
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
339static void choose_default_id(struct snd_card *card) 339static 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}
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index e4b8959dd4bb..19b3dcbb09c2 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -43,10 +43,6 @@ MODULE_DESCRIPTION("Memory allocator for ALSA system.");
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45 45
46#ifndef SNDRV_CARDS
47#define SNDRV_CARDS 8
48#endif
49
50/* 46/*
51 */ 47 */
52 48
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 95bd5ae92b92..2a9c6b316b14 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -47,6 +47,10 @@
47 * 47 *
48 */ 48 */
49 49
50/* range for dynamically allocated client numbers of kernel drivers */
51#define SNDRV_SEQ_DYNAMIC_CLIENT_BEGIN 16
52#define SNDRV_SEQ_DYNAMIC_CLIENT_END 48
53
50#define SNDRV_SEQ_LFLG_INPUT 0x0001 54#define SNDRV_SEQ_LFLG_INPUT 0x0001
51#define SNDRV_SEQ_LFLG_OUTPUT 0x0002 55#define SNDRV_SEQ_LFLG_OUTPUT 0x0002
52#define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT) 56#define SNDRV_SEQ_LFLG_OPEN (SNDRV_SEQ_LFLG_INPUT|SNDRV_SEQ_LFLG_OUTPUT)
@@ -203,7 +207,8 @@ int __init client_init_data(void)
203} 207}
204 208
205 209
206static struct snd_seq_client *seq_create_client1(int client_index, int poolsize) 210static struct snd_seq_client *seq_create_client1(int client_index, int poolsize,
211 int kernel_client)
207{ 212{
208 unsigned long flags; 213 unsigned long flags;
209 int c; 214 int c;
@@ -227,7 +232,15 @@ static struct snd_seq_client *seq_create_client1(int client_index, int poolsize)
227 /* find free slot in the client table */ 232 /* find free slot in the client table */
228 spin_lock_irqsave(&clients_lock, flags); 233 spin_lock_irqsave(&clients_lock, flags);
229 if (client_index < 0) { 234 if (client_index < 0) {
230 for (c = 128; c < SNDRV_SEQ_MAX_CLIENTS; c++) { 235 int cmin, cmax;
236 if (kernel_client) {
237 cmin = SNDRV_SEQ_DYNAMIC_CLIENT_BEGIN;
238 cmax = SNDRV_SEQ_DYNAMIC_CLIENT_END;
239 } else {
240 cmin = 128;
241 cmax = SNDRV_SEQ_MAX_CLIENTS;
242 }
243 for (c = cmin; c < cmax; c++) {
231 if (clienttab[c] || clienttablock[c]) 244 if (clienttab[c] || clienttablock[c])
232 continue; 245 continue;
233 clienttab[client->number = c] = client; 246 clienttab[client->number = c] = client;
@@ -306,7 +319,7 @@ static int snd_seq_open(struct inode *inode, struct file *file)
306 319
307 if (down_interruptible(&register_mutex)) 320 if (down_interruptible(&register_mutex))
308 return -ERESTARTSYS; 321 return -ERESTARTSYS;
309 client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); 322 client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS, 0);
310 if (client == NULL) { 323 if (client == NULL) {
311 up(&register_mutex); 324 up(&register_mutex);
312 return -ENOMEM; /* failure code */ 325 return -ENOMEM; /* failure code */
@@ -2212,13 +2225,19 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
2212 return -EINVAL; 2225 return -EINVAL;
2213 if (card == NULL && client_index > 63) 2226 if (card == NULL && client_index > 63)
2214 return -EINVAL; 2227 return -EINVAL;
2215 if (card)
2216 client_index += 64 + (card->number << 2);
2217 2228
2218 if (down_interruptible(&register_mutex)) 2229 if (down_interruptible(&register_mutex))
2219 return -ERESTARTSYS; 2230 return -ERESTARTSYS;
2231
2232 if (card) {
2233 if (card->number < 16)
2234 client_index += 64 + (card->number << 2);
2235 else
2236 client_index = -1;
2237 }
2238
2220 /* empty write queue as default */ 2239 /* empty write queue as default */
2221 client = seq_create_client1(client_index, 0); 2240 client = seq_create_client1(client_index, 0, 1);
2222 if (client == NULL) { 2241 if (client == NULL) {
2223 up(&register_mutex); 2242 up(&register_mutex);
2224 return -EBUSY; /* failure code */ 2243 return -EBUSY; /* failure code */
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 5e22283078fc..5febd0545d7d 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -358,15 +358,15 @@ static void snd_minor_info_read(struct snd_info_entry *entry, struct snd_info_bu
358 continue; 358 continue;
359 if (mptr->card >= 0) { 359 if (mptr->card >= 0) {
360 if (mptr->device >= 0) 360 if (mptr->device >= 0)
361 snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", 361 snd_iprintf(buffer, "%3i: [%2i-%2i]: %s\n",
362 minor, mptr->card, mptr->device, 362 minor, mptr->card, mptr->device,
363 snd_device_type_name(mptr->type)); 363 snd_device_type_name(mptr->type));
364 else 364 else
365 snd_iprintf(buffer, "%3i: [%i] : %s\n", 365 snd_iprintf(buffer, "%3i: [%2i] : %s\n",
366 minor, mptr->card, 366 minor, mptr->card,
367 snd_device_type_name(mptr->type)); 367 snd_device_type_name(mptr->type));
368 } else 368 } else
369 snd_iprintf(buffer, "%3i: : %s\n", minor, 369 snd_iprintf(buffer, "%3i: : %s\n", minor,
370 snd_device_type_name(mptr->type)); 370 snd_device_type_name(mptr->type));
371 } 371 }
372 up(&sound_mutex); 372 up(&sound_mutex);
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c
index b9e89cac4c5d..3ae1c0d7ffd0 100644
--- a/sound/core/sound_oss.c
+++ b/sound/core/sound_oss.c
@@ -105,6 +105,8 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev,
105 int register1 = -1, register2 = -1; 105 int register1 = -1, register2 = -1;
106 struct device *carddev = NULL; 106 struct device *carddev = NULL;
107 107
108 if (card && card->number >= 8)
109 return 0; /* ignore silently */
108 if (minor < 0) 110 if (minor < 0)
109 return minor; 111 return minor;
110 preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL); 112 preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL);
@@ -162,6 +164,8 @@ int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
162 int track2 = -1; 164 int track2 = -1;
163 struct snd_minor *mptr; 165 struct snd_minor *mptr;
164 166
167 if (card && card->number >= 8)
168 return 0;
165 if (minor < 0) 169 if (minor < 0)
166 return minor; 170 return minor;
167 down(&sound_oss_mutex); 171 down(&sound_oss_mutex);