diff options
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/seq/oss/seq_oss_init.c | 16 | ||||
-rw-r--r-- | sound/core/seq/seq_clientmgr.c | 8 | ||||
-rw-r--r-- | sound/core/seq/seq_dummy.c | 11 | ||||
-rw-r--r-- | sound/core/seq/seq_midi.c | 24 | ||||
-rw-r--r-- | sound/core/seq/seq_system.c | 16 | ||||
-rw-r--r-- | sound/core/seq/seq_virmidi.c | 17 |
6 files changed, 23 insertions, 69 deletions
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c index cd4139adec0..ca5a2ed4d7c 100644 --- a/sound/core/seq/oss/seq_oss_init.c +++ b/sound/core/seq/oss/seq_oss_init.c @@ -65,33 +65,24 @@ int __init snd_seq_oss_create_client(void) { int rc; - struct snd_seq_client_info *info; struct snd_seq_port_info *port; struct snd_seq_port_callback port_callback; - info = kmalloc(sizeof(*info), GFP_KERNEL); port = kmalloc(sizeof(*port), GFP_KERNEL); - if (!info || !port) { + if (!port) { rc = -ENOMEM; goto __error; } /* create ALSA client */ - rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS); + rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, + "OSS sequencer"); if (rc < 0) goto __error; system_client = rc; debug_printk(("new client = %d\n", rc)); - /* set client information */ - memset(info, 0, sizeof(*info)); - info->client = system_client; - info->type = KERNEL_CLIENT; - strcpy(info->name, "OSS sequencer"); - - rc = call_ctl(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info); - /* look up midi devices */ snd_seq_oss_midi_lookup_ports(system_client); @@ -124,7 +115,6 @@ snd_seq_oss_create_client(void) __error: kfree(port); - kfree(info); return rc; } diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index bd8c0989785..606d076f72f 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -2212,9 +2212,11 @@ static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg /* exported to kernel modules */ -int snd_seq_create_kernel_client(struct snd_card *card, int client_index) +int snd_seq_create_kernel_client(struct snd_card *card, int client_index, + const char *name_fmt, ...) { struct snd_seq_client *client; + va_list args; snd_assert(! in_interrupt(), return -EBUSY); @@ -2244,7 +2246,9 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index) client->accept_input = 1; client->accept_output = 1; - sprintf(client->name, "Client-%d", client->number); + va_start(args, name_fmt); + vsnprintf(client->name, sizeof(client->name), name_fmt, args); + va_end(args); client->type = KERNEL_CLIENT; up(®ister_mutex); diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index e7344b6332d..2a283a59ea4 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c @@ -193,7 +193,6 @@ create_port(int idx, int type) static int __init register_client(void) { - struct snd_seq_client_info cinfo; struct snd_seq_dummy_port *rec1, *rec2; int i; @@ -203,17 +202,11 @@ register_client(void) } /* create client */ - my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY); + my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY, + "Midi Through"); if (my_client < 0) return my_client; - /* set client name */ - memset(&cinfo, 0, sizeof(cinfo)); - cinfo.client = my_client; - cinfo.type = KERNEL_CLIENT; - strcpy(cinfo.name, "Midi Through"); - snd_seq_kernel_client_ctl(my_client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); - /* create ports */ for (i = 0; i < ports; i++) { rec1 = create_port(i, 0); 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); diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index c87c883bd92..b201b76e941 100644 --- a/sound/core/seq/seq_system.c +++ b/sound/core/seq/seq_system.c @@ -121,29 +121,18 @@ static int event_input_timer(struct snd_seq_event * ev, int direct, void *privat int __init snd_seq_system_client_init(void) { struct snd_seq_port_callback pcallbacks; - struct snd_seq_client_info *inf; struct snd_seq_port_info *port; - inf = kzalloc(sizeof(*inf), GFP_KERNEL); port = kzalloc(sizeof(*port), GFP_KERNEL); - if (! inf || ! port) { - kfree(inf); - kfree(port); + if (!port) return -ENOMEM; - } memset(&pcallbacks, 0, sizeof(pcallbacks)); pcallbacks.owner = THIS_MODULE; pcallbacks.event_input = event_input_timer; /* register client */ - sysclient = snd_seq_create_kernel_client(NULL, 0); - - /* set our name */ - inf->client = 0; - inf->type = KERNEL_CLIENT; - strcpy(inf->name, "System"); - snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, inf); + sysclient = snd_seq_create_kernel_client(NULL, 0, "System"); /* register timer */ strcpy(port->name, "Timer"); @@ -167,7 +156,6 @@ int __init snd_seq_system_client_init(void) snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); announce_port = port->addr.port; - kfree(inf); kfree(port); return 0; } diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c index 2739f577257..14fd1a608e1 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) { int client; struct snd_seq_port_callback pcallbacks; - struct snd_seq_client_info *info; struct snd_seq_port_info *pinfo; int err; if (rdev->client >= 0) return 0; - info = kmalloc(sizeof(*info), GFP_KERNEL); pinfo = kmalloc(sizeof(*pinfo), GFP_KERNEL); - if (! info || ! pinfo) { + if (!pinfo) { err = -ENOMEM; goto __error; } - client = snd_seq_create_kernel_client(rdev->card, rdev->device); + client = snd_seq_create_kernel_client(rdev->card, rdev->device, + "%s %d-%d", rdev->rmidi->name, + rdev->card->number, + rdev->device); if (client < 0) { err = client; goto __error; } rdev->client = client; - /* set client name */ - memset(info, 0, sizeof(*info)); - info->client = client; - info->type = KERNEL_CLIENT; - sprintf(info->name, "%s %d-%d", rdev->rmidi->name, rdev->card->number, rdev->device); - snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info); - /* create a port */ memset(pinfo, 0, sizeof(*pinfo)); pinfo->addr.client = client; @@ -418,7 +412,6 @@ static int snd_virmidi_dev_attach_seq(struct snd_virmidi_dev *rdev) err = 0; /* success */ __error: - kfree(info); kfree(pinfo); return err; } |