[ALSA] dynamic minors (5/6): reduce maximum number of MIDI devices per card

Modules: ALSA sequencer,Generic drivers

To allow increasing the maximum number of sound cards, we have to limit
the number of sequencer clients per card because client numbers are
still allocated statically.

Reducing the number of clients to four limits the number of sequencer
MIDI ports to 1024 per card.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
Clemens Ladisch 2005-11-20 14:08:28 +01:00 committed by Jaroslav Kysela
parent 332682b1cd
commit 204bdb1b50
2 changed files with 5 additions and 5 deletions

View File

@ -157,7 +157,7 @@ struct snd_seq_client *snd_seq_client_use_ptr(int clientid)
} }
} }
} else if (clientid >= 64 && clientid < 128) { } else if (clientid >= 64 && clientid < 128) {
int card = (clientid - 64) / 8; int card = (clientid - 64) / 4;
if (card < snd_ecards_limit) { if (card < snd_ecards_limit) {
if (! card_requested[card]) { if (! card_requested[card]) {
card_requested[card] = 1; card_requested[card] = 1;
@ -2208,12 +2208,12 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index,
if (callback == NULL) if (callback == NULL)
return -EINVAL; return -EINVAL;
if (card && client_index > 7) if (card && client_index > 3)
return -EINVAL; return -EINVAL;
if (card == NULL && client_index > 63) if (card == NULL && client_index > 63)
return -EINVAL; return -EINVAL;
if (card) if (card)
client_index += 64 + (card->number << 3); client_index += 64 + (card->number << 2);
if (down_interruptible(&register_mutex)) if (down_interruptible(&register_mutex))
return -ERESTARTSYS; return -ERESTARTSYS;

View File

@ -61,7 +61,7 @@ MODULE_DESCRIPTION("Dummy soundcard for virtual rawmidi devices");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}"); MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}");
#define MAX_MIDI_DEVICES 8 #define MAX_MIDI_DEVICES 4
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
@ -75,7 +75,7 @@ MODULE_PARM_DESC(id, "ID string for virmidi soundcard.");
module_param_array(enable, bool, NULL, 0444); module_param_array(enable, bool, NULL, 0444);
MODULE_PARM_DESC(enable, "Enable this soundcard."); MODULE_PARM_DESC(enable, "Enable this soundcard.");
module_param_array(midi_devs, int, NULL, 0444); module_param_array(midi_devs, int, NULL, 0444);
MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-8)"); MODULE_PARM_DESC(midi_devs, "MIDI devices # (1-4)");
struct snd_card_virmidi { struct snd_card_virmidi {
struct snd_card *card; struct snd_card *card;