[ALSA] seq: set client name in snd_seq_create_kernel_client()

All users of snd_seq_create_kernel_client() have to set the client name
anyway, so we can just pass the name as parameter.  This relieves us
from having to muck around with a struct snd_seq_client_info in these
cases.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
Clemens Ladisch
2005-12-12 09:33:37 +01:00
committed by Jaroslav Kysela
parent 83e8ad6984
commit 7b6d92451a
12 changed files with 43 additions and 146 deletions
+2 -27
View File
@@ -28,7 +28,6 @@ static void free_port(void *private);
static void snd_emux_init_port(struct snd_emux_port *p);
static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info);
static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info);
static int get_client(struct snd_card *card, int index, char *name);
/*
* MIDI emulation operators
@@ -71,8 +70,8 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
struct snd_seq_port_callback pinfo;
char tmpname[64];
sprintf(tmpname, "%s WaveTable", emu->name);
emu->client = get_client(card, index, tmpname);
emu->client = snd_seq_create_kernel_client(card, index,
"%s WaveTable", emu->name);
if (emu->client < 0) {
snd_printk("can't create client\n");
return -ENODEV;
@@ -341,30 +340,6 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
}
/*
* Create a sequencer client
*/
static int
get_client(struct snd_card *card, int index, char *name)
{
struct snd_seq_client_info cinfo;
int client;
/* Find a free client, start from 1 as the MPU expects to use 0 */
client = snd_seq_create_kernel_client(card, index);
if (client < 0)
return client;
memset(&cinfo, 0, sizeof(cinfo));
cinfo.client = client;
cinfo.type = KERNEL_CLIENT;
strcpy(cinfo.name, name);
snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo);
return client;
}
/*
* attach virtual rawmidi devices
*/