aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/seq/seq_virmidi.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-12-12 03:33:37 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:30:49 -0500
commit7b6d92451ad5e1136dc347347e888b94638b8ba9 (patch)
treee62edf62f29e988378cd2c984cde0ccb0993120b /sound/core/seq/seq_virmidi.c
parent83e8ad6984dccd6d848ac91ba0df379ff968180b (diff)
[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>
Diffstat (limited to 'sound/core/seq/seq_virmidi.c')
-rw-r--r--sound/core/seq/seq_virmidi.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 2739f5772578..14fd1a608e14 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -360,34 +360,28 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
360{ 360{
361 int client; 361 int client;
362 struct snd_seq_port_callback pcallbacks; 362 struct snd_seq_port_callback pcallbacks;
363 struct snd_seq_client_info *info;
364 struct snd_seq_port_info *pinfo; 363 struct snd_seq_port_info *pinfo;
365 int err; 364 int err;
366 365
367 if (rdev->client >= 0) 366 if (rdev->client >= 0)
368 return 0; 367 return 0;
369 368
370 info = kmalloc(sizeof(*info), GFP_KERNEL);
371 pinfo = kmalloc(sizeof(*pinfo), GFP_KERNEL); 369 pinfo = kmalloc(sizeof(*pinfo), GFP_KERNEL);
372 if (! info || ! pinfo) { 370 if (!pinfo) {
373 err = -ENOMEM; 371 err = -ENOMEM;
374 goto __error; 372 goto __error;
375 } 373 }
376 374
377 client = snd_seq_create_kernel_client(rdev->card, rdev->device); 375 client = snd_seq_create_kernel_client(rdev->card, rdev->device,
376 "%s %d-%d", rdev->rmidi->name,
377 rdev->card->number,
378 rdev->device);
378 if (client < 0) { 379 if (client < 0) {
379 err = client; 380 err = client;
380 goto __error; 381 goto __error;
381 } 382 }
382 rdev->client = client; 383 rdev->client = client;
383 384
384 /* set client name */
385 memset(info, 0, sizeof(*info));
386 info->client = client;
387 info->type = KERNEL_CLIENT;
388 sprintf(info->name, "%s %d-%d", rdev->rmidi->name, rdev->card->number, rdev->device);
389 snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info);
390
391 /* create a port */ 385 /* create a port */
392 memset(pinfo, 0, sizeof(*pinfo)); 386 memset(pinfo, 0, sizeof(*pinfo));
393 pinfo->addr.client = client; 387 pinfo->addr.client = client;
@@ -418,7 +412,6 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev)
418 err = 0; /* success */ 412 err = 0; /* success */
419 413
420 __error: 414 __error:
421 kfree(info);
422 kfree(pinfo); 415 kfree(pinfo);
423 return err; 416 return err;
424} 417}