diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2005-12-12 03:33:37 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:30:49 -0500 |
commit | 7b6d92451ad5e1136dc347347e888b94638b8ba9 (patch) | |
tree | e62edf62f29e988378cd2c984cde0ccb0993120b | |
parent | 83e8ad6984dccd6d848ac91ba0df379ff968180b (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>
-rw-r--r-- | include/sound/seq_kernel.h | 4 | ||||
-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 | ||||
-rw-r--r-- | sound/drivers/opl3/opl3_seq.c | 17 | ||||
-rw-r--r-- | sound/drivers/opl4/opl4_seq.c | 11 | ||||
-rw-r--r-- | sound/isa/gus/gus_synth.c | 20 | ||||
-rw-r--r-- | sound/pci/trident/trident_synth.c | 16 | ||||
-rw-r--r-- | sound/synth/emux/emux_seq.c | 29 |
12 files changed, 43 insertions, 146 deletions
diff --git a/include/sound/seq_kernel.h b/include/sound/seq_kernel.h index 77cf57e21489..f023c1b97f8c 100644 --- a/include/sound/seq_kernel.h +++ b/include/sound/seq_kernel.h | |||
@@ -75,7 +75,9 @@ struct snd_seq_port_callback { | |||
75 | }; | 75 | }; |
76 | 76 | ||
77 | /* interface for kernel client */ | 77 | /* interface for kernel client */ |
78 | int snd_seq_create_kernel_client(struct snd_card *card, int client_index); | 78 | int snd_seq_create_kernel_client(struct snd_card *card, int client_index, |
79 | const char *name_fmt, ...) | ||
80 | __attribute__ ((format (printf, 3, 4))); | ||
79 | int snd_seq_delete_kernel_client(int client); | 81 | int snd_seq_delete_kernel_client(int client); |
80 | int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); | 82 | int snd_seq_kernel_client_enqueue(int client, struct snd_seq_event *ev, int atomic, int hop); |
81 | int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); | 83 | int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event *ev, int atomic, int hop); |
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 | } |
diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c index 582ff63e784b..c4ead790008a 100644 --- a/sound/drivers/opl3/opl3_seq.c +++ b/sound/drivers/opl3/opl3_seq.c | |||
@@ -219,7 +219,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) | |||
219 | { | 219 | { |
220 | struct snd_opl3 *opl3; | 220 | struct snd_opl3 *opl3; |
221 | int client; | 221 | int client; |
222 | struct snd_seq_client_info cinfo; | 222 | char name[32]; |
223 | int opl_ver; | 223 | int opl_ver; |
224 | 224 | ||
225 | opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); | 225 | opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); |
@@ -231,19 +231,14 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) | |||
231 | opl3->seq_client = -1; | 231 | opl3->seq_client = -1; |
232 | 232 | ||
233 | /* allocate new client */ | 233 | /* allocate new client */ |
234 | opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8; | ||
235 | sprintf(name, "OPL%i FM synth", opl_ver); | ||
234 | client = opl3->seq_client = | 236 | client = opl3->seq_client = |
235 | snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num); | 237 | snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num, |
238 | name); | ||
236 | if (client < 0) | 239 | if (client < 0) |
237 | return client; | 240 | return client; |
238 | 241 | ||
239 | /* change name of client */ | ||
240 | memset(&cinfo, 0, sizeof(cinfo)); | ||
241 | cinfo.client = client; | ||
242 | cinfo.type = KERNEL_CLIENT; | ||
243 | opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8; | ||
244 | sprintf(cinfo.name, "OPL%i FM synth", opl_ver); | ||
245 | snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | ||
246 | |||
247 | snd_opl3_synth_create_port(opl3); | 242 | snd_opl3_synth_create_port(opl3); |
248 | 243 | ||
249 | /* initialize instrument list */ | 244 | /* initialize instrument list */ |
@@ -264,7 +259,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev) | |||
264 | opl3->sys_timer_status = 0; | 259 | opl3->sys_timer_status = 0; |
265 | 260 | ||
266 | #ifdef CONFIG_SND_SEQUENCER_OSS | 261 | #ifdef CONFIG_SND_SEQUENCER_OSS |
267 | snd_opl3_init_seq_oss(opl3, cinfo.name); | 262 | snd_opl3_init_seq_oss(opl3, name); |
268 | #endif | 263 | #endif |
269 | return 0; | 264 | return 0; |
270 | } | 265 | } |
diff --git a/sound/drivers/opl4/opl4_seq.c b/sound/drivers/opl4/opl4_seq.c index a69117dd0071..e3480326e735 100644 --- a/sound/drivers/opl4/opl4_seq.c +++ b/sound/drivers/opl4/opl4_seq.c | |||
@@ -127,7 +127,6 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev) | |||
127 | { | 127 | { |
128 | struct snd_opl4 *opl4; | 128 | struct snd_opl4 *opl4; |
129 | int client; | 129 | int client; |
130 | struct snd_seq_client_info cinfo; | ||
131 | struct snd_seq_port_callback pcallbacks; | 130 | struct snd_seq_port_callback pcallbacks; |
132 | 131 | ||
133 | opl4 = *(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); | 132 | opl4 = *(struct snd_opl4 **)SNDRV_SEQ_DEVICE_ARGPTR(dev); |
@@ -143,7 +142,8 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev) | |||
143 | opl4->chset->private_data = opl4; | 142 | opl4->chset->private_data = opl4; |
144 | 143 | ||
145 | /* allocate new client */ | 144 | /* allocate new client */ |
146 | client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num); | 145 | client = snd_seq_create_kernel_client(opl4->card, opl4->seq_dev_num, |
146 | "OPL4 Wavetable"); | ||
147 | if (client < 0) { | 147 | if (client < 0) { |
148 | snd_midi_channel_free_set(opl4->chset); | 148 | snd_midi_channel_free_set(opl4->chset); |
149 | return client; | 149 | return client; |
@@ -151,13 +151,6 @@ static int snd_opl4_seq_new_device(struct snd_seq_device *dev) | |||
151 | opl4->seq_client = client; | 151 | opl4->seq_client = client; |
152 | opl4->chset->client = client; | 152 | opl4->chset->client = client; |
153 | 153 | ||
154 | /* change name of client */ | ||
155 | memset(&cinfo, 0, sizeof(cinfo)); | ||
156 | cinfo.client = client; | ||
157 | cinfo.type = KERNEL_CLIENT; | ||
158 | strcpy(cinfo.name, "OPL4 Wavetable"); | ||
159 | snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | ||
160 | |||
161 | /* create new port */ | 154 | /* create new port */ |
162 | memset(&pcallbacks, 0, sizeof(pcallbacks)); | 155 | memset(&pcallbacks, 0, sizeof(pcallbacks)); |
163 | pcallbacks.owner = THIS_MODULE; | 156 | pcallbacks.owner = THIS_MODULE; |
diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c index 6464488363e4..85a1b051f09a 100644 --- a/sound/isa/gus/gus_synth.c +++ b/sound/isa/gus/gus_synth.c | |||
@@ -214,7 +214,6 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) | |||
214 | { | 214 | { |
215 | struct snd_gus_card *gus; | 215 | struct snd_gus_card *gus; |
216 | int client, i; | 216 | int client, i; |
217 | struct snd_seq_client_info *cinfo; | ||
218 | struct snd_seq_port_subscribe sub; | 217 | struct snd_seq_port_subscribe sub; |
219 | struct snd_iwffff_ops *iwops; | 218 | struct snd_iwffff_ops *iwops; |
220 | struct snd_gf1_ops *gf1ops; | 219 | struct snd_gf1_ops *gf1ops; |
@@ -227,25 +226,12 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) | |||
227 | init_MUTEX(&gus->register_mutex); | 226 | init_MUTEX(&gus->register_mutex); |
228 | gus->gf1.seq_client = -1; | 227 | gus->gf1.seq_client = -1; |
229 | 228 | ||
230 | cinfo = kmalloc(sizeof(*cinfo), GFP_KERNEL); | ||
231 | if (! cinfo) | ||
232 | return -ENOMEM; | ||
233 | |||
234 | /* allocate new client */ | 229 | /* allocate new client */ |
235 | client = gus->gf1.seq_client = | 230 | client = gus->gf1.seq_client = |
236 | snd_seq_create_kernel_client(gus->card, 1); | 231 | snd_seq_create_kernel_client(gus->card, 1, gus->interwave ? |
237 | if (client < 0) { | 232 | "AMD InterWave" : "GF1"); |
238 | kfree(cinfo); | 233 | if (client < 0) |
239 | return client; | 234 | return client; |
240 | } | ||
241 | |||
242 | /* change name of client */ | ||
243 | memset(cinfo, 0, sizeof(*cinfo)); | ||
244 | cinfo->client = client; | ||
245 | cinfo->type = KERNEL_CLIENT; | ||
246 | sprintf(cinfo->name, gus->interwave ? "AMD InterWave" : "GF1"); | ||
247 | snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, cinfo); | ||
248 | kfree(cinfo); | ||
249 | 235 | ||
250 | for (i = 0; i < 4; i++) | 236 | for (i = 0; i < 4; i++) |
251 | snd_gus_synth_create_port(gus, i); | 237 | snd_gus_synth_create_port(gus, i); |
diff --git a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c index e31055a4bd25..cc7af8bc55a0 100644 --- a/sound/pci/trident/trident_synth.c +++ b/sound/pci/trident/trident_synth.c | |||
@@ -934,7 +934,6 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev) | |||
934 | { | 934 | { |
935 | struct snd_trident *trident; | 935 | struct snd_trident *trident; |
936 | int client, i; | 936 | int client, i; |
937 | struct snd_seq_client_info cinfo; | ||
938 | struct snd_seq_port_subscribe sub; | 937 | struct snd_seq_port_subscribe sub; |
939 | struct snd_simple_ops *simpleops; | 938 | struct snd_simple_ops *simpleops; |
940 | char *str; | 939 | char *str; |
@@ -946,23 +945,16 @@ static int snd_trident_synth_new_device(struct snd_seq_device *dev) | |||
946 | trident->synth.seq_client = -1; | 945 | trident->synth.seq_client = -1; |
947 | 946 | ||
948 | /* allocate new client */ | 947 | /* allocate new client */ |
949 | client = trident->synth.seq_client = | ||
950 | snd_seq_create_kernel_client(trident->card, 1); | ||
951 | if (client < 0) | ||
952 | return client; | ||
953 | |||
954 | /* change name of client */ | ||
955 | memset(&cinfo, 0, sizeof(cinfo)); | ||
956 | cinfo.client = client; | ||
957 | cinfo.type = KERNEL_CLIENT; | ||
958 | str = "???"; | 948 | str = "???"; |
959 | switch (trident->device) { | 949 | switch (trident->device) { |
960 | case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break; | 950 | case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break; |
961 | case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break; | 951 | case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break; |
962 | case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break; | 952 | case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break; |
963 | } | 953 | } |
964 | sprintf(cinfo.name, str); | 954 | client = trident->synth.seq_client = |
965 | snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | 955 | snd_seq_create_kernel_client(trident->card, 1, str); |
956 | if (client < 0) | ||
957 | return client; | ||
966 | 958 | ||
967 | for (i = 0; i < 4; i++) | 959 | for (i = 0; i < 4; i++) |
968 | snd_trident_synth_create_port(trident, i); | 960 | snd_trident_synth_create_port(trident, i); |
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c index b7129c5aee06..1a973d7a90f8 100644 --- a/sound/synth/emux/emux_seq.c +++ b/sound/synth/emux/emux_seq.c | |||
@@ -28,7 +28,6 @@ static void free_port(void *private); | |||
28 | static void snd_emux_init_port(struct snd_emux_port *p); | 28 | static void snd_emux_init_port(struct snd_emux_port *p); |
29 | static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info); | 29 | static int snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info); |
30 | static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info); | 30 | static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info); |
31 | static int get_client(struct snd_card *card, int index, char *name); | ||
32 | 31 | ||
33 | /* | 32 | /* |
34 | * MIDI emulation operators | 33 | * MIDI emulation operators |
@@ -71,8 +70,8 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index) | |||
71 | struct snd_seq_port_callback pinfo; | 70 | struct snd_seq_port_callback pinfo; |
72 | char tmpname[64]; | 71 | char tmpname[64]; |
73 | 72 | ||
74 | sprintf(tmpname, "%s WaveTable", emu->name); | 73 | emu->client = snd_seq_create_kernel_client(card, index, |
75 | emu->client = get_client(card, index, tmpname); | 74 | "%s WaveTable", emu->name); |
76 | if (emu->client < 0) { | 75 | if (emu->client < 0) { |
77 | snd_printk("can't create client\n"); | 76 | snd_printk("can't create client\n"); |
78 | return -ENODEV; | 77 | return -ENODEV; |
@@ -342,30 +341,6 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info) | |||
342 | 341 | ||
343 | 342 | ||
344 | /* | 343 | /* |
345 | * Create a sequencer client | ||
346 | */ | ||
347 | static int | ||
348 | get_client(struct snd_card *card, int index, char *name) | ||
349 | { | ||
350 | struct snd_seq_client_info cinfo; | ||
351 | int client; | ||
352 | |||
353 | /* Find a free client, start from 1 as the MPU expects to use 0 */ | ||
354 | client = snd_seq_create_kernel_client(card, index); | ||
355 | if (client < 0) | ||
356 | return client; | ||
357 | |||
358 | memset(&cinfo, 0, sizeof(cinfo)); | ||
359 | cinfo.client = client; | ||
360 | cinfo.type = KERNEL_CLIENT; | ||
361 | strcpy(cinfo.name, name); | ||
362 | snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); | ||
363 | |||
364 | return client; | ||
365 | } | ||
366 | |||
367 | |||
368 | /* | ||
369 | * attach virtual rawmidi devices | 344 | * attach virtual rawmidi devices |
370 | */ | 345 | */ |
371 | int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) | 346 | int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card) |