From 7b6d92451ad5e1136dc347347e888b94638b8ba9 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 12 Dec 2005 09:33:37 +0100 Subject: [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 --- sound/core/seq/seq_midi.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'sound/core/seq/seq_midi.c') diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 512ffddd158..ce0df86157d 100644 --- a/sound/core/seq/seq_midi.c +++ b/sound/core/seq/seq_midi.c @@ -270,21 +270,6 @@ static void snd_seq_midisynth_delete(struct seq_midisynth *msynth) snd_midi_event_free(msynth->parser); } -/* set our client name */ -static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card, - struct snd_rawmidi_info *rmidi) -{ - struct snd_seq_client_info cinfo; - const char *name; - - memset(&cinfo, 0, sizeof(cinfo)); - cinfo.client = client->seq_client; - cinfo.type = KERNEL_CLIENT; - name = rmidi->name[0] ? (const char *)rmidi->name : "External MIDI"; - strlcpy(cinfo.name, name, sizeof(cinfo.name)); - return snd_seq_kernel_client_ctl(client->seq_client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); -} - /* register new midi synth port */ static int snd_seq_midisynth_register_port(struct snd_seq_device *dev) @@ -333,16 +318,17 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev) kfree(info); return -ENOMEM; } - client->seq_client = snd_seq_create_kernel_client(card, 0); + client->seq_client = + snd_seq_create_kernel_client( + card, 0, "%s", info->name[0] ? + (const char *)info->name : "External MIDI"); if (client->seq_client < 0) { kfree(client); up(®ister_mutex); kfree(info); return -ENOMEM; } - set_client_name(client, card, info); - } else if (device == 0) - set_client_name(client, card, info); /* use the first device's name */ + } msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); port = kmalloc(sizeof(*port), GFP_KERNEL); -- cgit v1.2.3