diff options
Diffstat (limited to 'sound/core/seq')
-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 cd4139adec0b..ca5a2ed4d7c3 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 | |||
65 | snd_seq_oss_create_client(void) | 65 | snd_seq_oss_create_client(void) |
66 | { | 66 | { |
67 | int rc; | 67 | int rc; |
68 | struct snd_seq_client_info *info; | ||
69 | struct snd_seq_port_info *port; | 68 | struct snd_seq_port_info *port; |
70 | struct snd_seq_port_callback port_callback; | 69 | struct snd_seq_port_callback port_callback; |
71 | 70 | ||
72 | info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
73 | port = kmalloc(sizeof(*port), GFP_KERNEL); | 71 | port = kmalloc(sizeof(*port), GFP_KERNEL); |
74 | if (!info || !port) { | 72 | if (!port) { |
75 | rc = -ENOMEM; | 73 | rc = -ENOMEM; |
76 | goto __error; | 74 | goto __error; |
77 | } | 75 | } |
78 | 76 | ||
79 | /* create ALSA client */ | 77 | /* create ALSA client */ |
80 | rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS); | 78 | rc = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_OSS, |
79 | "OSS sequencer"); | ||
81 | if (rc < 0) | 80 | if (rc < 0) |
82 | goto __error; | 81 | goto __error; |
83 | 82 | ||
84 | system_client = rc; | 83 | system_client = rc; |
85 | debug_printk(("new client = %d\n", rc)); | 84 | debug_printk(("new client = %d\n", rc)); |
86 | 85 | ||
87 | /* set client information */ | ||
88 | memset(info, 0, sizeof(*info)); | ||
89 | info->client = system_client; | ||
90 | info->type = KERNEL_CLIENT; | ||
91 | strcpy(info->name, "OSS sequencer"); | ||
92 | |||
93 | rc = call_ctl(SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, info); | ||
94 | |||
95 | /* look up midi devices */ | 86 | /* look up midi devices */ |
96 | snd_seq_oss_midi_lookup_ports(system_client); | 87 | snd_seq_oss_midi_lookup_ports(system_client); |
97 | 88 | ||
@@ -124,7 +115,6 @@ snd_seq_oss_create_client(void) | |||
124 | 115 | ||
125 | __error: | 116 | __error: |
126 | kfree(port); | 117 | kfree(port); |
127 | kfree(info); | ||
128 | return rc; | 118 | return rc; |
129 | } | 119 | } |
130 | 120 | ||
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index bd8c0989785f..606d076f72f4 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 | |||
2212 | 2212 | ||
2213 | 2213 | ||
2214 | /* exported to kernel modules */ | 2214 | /* exported to kernel modules */ |
2215 | int snd_seq_create_kernel_client(struct snd_card *card, int client_index) | 2215 | int snd_seq_create_kernel_client(struct snd_card *card, int client_index, |
2216 | const char *name_fmt, ...) | ||
2216 | { | 2217 | { |
2217 | struct snd_seq_client *client; | 2218 | struct snd_seq_client *client; |
2219 | va_list args; | ||
2218 | 2220 | ||
2219 | snd_assert(! in_interrupt(), return -EBUSY); | 2221 | snd_assert(! in_interrupt(), return -EBUSY); |
2220 | 2222 | ||
@@ -2244,7 +2246,9 @@ int snd_seq_create_kernel_client(struct snd_card *card, int client_index) | |||
2244 | client->accept_input = 1; | 2246 | client->accept_input = 1; |
2245 | client->accept_output = 1; | 2247 | client->accept_output = 1; |
2246 | 2248 | ||
2247 | sprintf(client->name, "Client-%d", client->number); | 2249 | va_start(args, name_fmt); |
2250 | vsnprintf(client->name, sizeof(client->name), name_fmt, args); | ||
2251 | va_end(args); | ||
2248 | 2252 | ||
2249 | client->type = KERNEL_CLIENT; | 2253 | client->type = KERNEL_CLIENT; |
2250 | up(®ister_mutex); | 2254 | up(®ister_mutex); |
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index e7344b6332da..2a283a59ea4d 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) | |||
193 | static int __init | 193 | static int __init |
194 | register_client(void) | 194 | register_client(void) |
195 | { | 195 | { |
196 | struct snd_seq_client_info cinfo; | ||
197 | struct snd_seq_dummy_port *rec1, *rec2; | 196 | struct snd_seq_dummy_port *rec1, *rec2; |
198 | int i; | 197 | int i; |
199 | 198 | ||
@@ -203,17 +202,11 @@ register_client(void) | |||
203 | } | 202 | } |
204 | 203 | ||
205 | /* create client */ | 204 | /* create client */ |
206 | my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY); | 205 | my_client = snd_seq_create_kernel_client(NULL, SNDRV_SEQ_CLIENT_DUMMY, |
206 | "Midi Through"); | ||
207 | if (my_client < 0) | 207 | if (my_client < 0) |
208 | return my_client; | 208 | return my_client; |
209 | 209 | ||
210 | /* set client name */ | ||
211 | memset(&cinfo, 0, sizeof(cinfo)); | ||
212 | cinfo.client = my_client; | ||
213 | cinfo.type = KERNEL_CLIENT; | ||
214 | strcpy(cinfo.name, "Midi Through"); | ||
215 | snd_seq_kernel_client_ctl(my_client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | ||
216 | |||
217 | /* create ports */ | 210 | /* create ports */ |
218 | for (i = 0; i < ports; i++) { | 211 | for (i = 0; i < ports; i++) { |
219 | rec1 = create_port(i, 0); | 212 | rec1 = create_port(i, 0); |
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c index 512ffddd158c..ce0df86157de 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) | |||
270 | snd_midi_event_free(msynth->parser); | 270 | snd_midi_event_free(msynth->parser); |
271 | } | 271 | } |
272 | 272 | ||
273 | /* set our client name */ | ||
274 | static int set_client_name(struct seq_midisynth_client *client, struct snd_card *card, | ||
275 | struct snd_rawmidi_info *rmidi) | ||
276 | { | ||
277 | struct snd_seq_client_info cinfo; | ||
278 | const char *name; | ||
279 | |||
280 | memset(&cinfo, 0, sizeof(cinfo)); | ||
281 | cinfo.client = client->seq_client; | ||
282 | cinfo.type = KERNEL_CLIENT; | ||
283 | name = rmidi->name[0] ? (const char *)rmidi->name : "External MIDI"; | ||
284 | strlcpy(cinfo.name, name, sizeof(cinfo.name)); | ||
285 | return snd_seq_kernel_client_ctl(client->seq_client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | ||
286 | } | ||
287 | |||
288 | /* register new midi synth port */ | 273 | /* register new midi synth port */ |
289 | static int | 274 | static int |
290 | snd_seq_midisynth_register_port(struct snd_seq_device *dev) | 275 | snd_seq_midisynth_register_port(struct snd_seq_device *dev) |
@@ -333,16 +318,17 @@ snd_seq_midisynth_register_port(struct snd_seq_device *dev) | |||
333 | kfree(info); | 318 | kfree(info); |
334 | return -ENOMEM; | 319 | return -ENOMEM; |
335 | } | 320 | } |
336 | client->seq_client = snd_seq_create_kernel_client(card, 0); | 321 | client->seq_client = |
322 | snd_seq_create_kernel_client( | ||
323 | card, 0, "%s", info->name[0] ? | ||
324 | (const char *)info->name : "External MIDI"); | ||
337 | if (client->seq_client < 0) { | 325 | if (client->seq_client < 0) { |
338 | kfree(client); | 326 | kfree(client); |
339 | up(®ister_mutex); | 327 | up(®ister_mutex); |
340 | kfree(info); | 328 | kfree(info); |
341 | return -ENOMEM; | 329 | return -ENOMEM; |
342 | } | 330 | } |
343 | set_client_name(client, card, info); | 331 | } |
344 | } else if (device == 0) | ||
345 | set_client_name(client, card, info); /* use the first device's name */ | ||
346 | 332 | ||
347 | msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); | 333 | msynth = kcalloc(ports, sizeof(struct seq_midisynth), GFP_KERNEL); |
348 | port = kmalloc(sizeof(*port), GFP_KERNEL); | 334 | port = kmalloc(sizeof(*port), GFP_KERNEL); |
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c index c87c883bd92d..b201b76e9412 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 | |||
121 | int __init snd_seq_system_client_init(void) | 121 | int __init snd_seq_system_client_init(void) |
122 | { | 122 | { |
123 | struct snd_seq_port_callback pcallbacks; | 123 | struct snd_seq_port_callback pcallbacks; |
124 | struct snd_seq_client_info *inf; | ||
125 | struct snd_seq_port_info *port; | 124 | struct snd_seq_port_info *port; |
126 | 125 | ||
127 | inf = kzalloc(sizeof(*inf), GFP_KERNEL); | ||
128 | port = kzalloc(sizeof(*port), GFP_KERNEL); | 126 | port = kzalloc(sizeof(*port), GFP_KERNEL); |
129 | if (! inf || ! port) { | 127 | if (!port) |
130 | kfree(inf); | ||
131 | kfree(port); | ||
132 | return -ENOMEM; | 128 | return -ENOMEM; |
133 | } | ||
134 | 129 | ||
135 | memset(&pcallbacks, 0, sizeof(pcallbacks)); | 130 | memset(&pcallbacks, 0, sizeof(pcallbacks)); |
136 | pcallbacks.owner = THIS_MODULE; | 131 | pcallbacks.owner = THIS_MODULE; |
137 | pcallbacks.event_input = event_input_timer; | 132 | pcallbacks.event_input = event_input_timer; |
138 | 133 | ||
139 | /* register client */ | 134 | /* register client */ |
140 | sysclient = snd_seq_create_kernel_client(NULL, 0); | 135 | sysclient = snd_seq_create_kernel_client(NULL, 0, "System"); |
141 | |||
142 | /* set our name */ | ||
143 | inf->client = 0; | ||
144 | inf->type = KERNEL_CLIENT; | ||
145 | strcpy(inf->name, "System"); | ||
146 | snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, inf); | ||
147 | 136 | ||
148 | /* register timer */ | 137 | /* register timer */ |
149 | strcpy(port->name, "Timer"); | 138 | strcpy(port->name, "Timer"); |
@@ -167,7 +156,6 @@ int __init snd_seq_system_client_init(void) | |||
167 | snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); | 156 | snd_seq_kernel_client_ctl(sysclient, SNDRV_SEQ_IOCTL_CREATE_PORT, port); |
168 | announce_port = port->addr.port; | 157 | announce_port = port->addr.port; |
169 | 158 | ||
170 | kfree(inf); | ||
171 | kfree(port); | 159 | kfree(port); |
172 | return 0; | 160 | return 0; |
173 | } | 161 | } |
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 | } |