aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usx2y/usbusx2y.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 19:38:36 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-04 19:38:36 -0500
commit4da5cc2cec8caec1d357053e85a7a32f243f93a1 (patch)
tree3f8b603af4af88f86be7ec1d4e3639a7fc9dd1a6 /sound/usb/usx2y/usbusx2y.c
parent25c862cc9ea9b312c25a9f577f91b973131f1261 (diff)
parentc6f43290ae687c11cdcd150d8bfeb57ec29cfa5b (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/perex/alsa
Diffstat (limited to 'sound/usb/usx2y/usbusx2y.c')
-rw-r--r--sound/usb/usx2y/usbusx2y.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index a3967f72ab4e..e0abb56bbe49 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -167,28 +167,28 @@ MODULE_PARM_DESC(enable, "Enable "NAME_ALLCAPS".");
167static int snd_usX2Y_card_used[SNDRV_CARDS]; 167static int snd_usX2Y_card_used[SNDRV_CARDS];
168 168
169static void usX2Y_usb_disconnect(struct usb_device* usb_device, void* ptr); 169static void usX2Y_usb_disconnect(struct usb_device* usb_device, void* ptr);
170static void snd_usX2Y_card_private_free(snd_card_t *card); 170static void snd_usX2Y_card_private_free(struct snd_card *card);
171 171
172/* 172/*
173 * pipe 4 is used for switching the lamps, setting samplerate, volumes .... 173 * pipe 4 is used for switching the lamps, setting samplerate, volumes ....
174 */ 174 */
175static void i_usX2Y_Out04Int(struct urb* urb, struct pt_regs *regs) 175static void i_usX2Y_Out04Int(struct urb *urb, struct pt_regs *regs)
176{ 176{
177#ifdef CONFIG_SND_DEBUG 177#ifdef CONFIG_SND_DEBUG
178 if (urb->status) { 178 if (urb->status) {
179 int i; 179 int i;
180 usX2Ydev_t* usX2Y = urb->context; 180 struct usX2Ydev *usX2Y = urb->context;
181 for (i = 0; i < 10 && usX2Y->AS04.urb[i] != urb; i++); 181 for (i = 0; i < 10 && usX2Y->AS04.urb[i] != urb; i++);
182 snd_printdd("i_usX2Y_Out04Int() urb %i status=%i\n", i, urb->status); 182 snd_printdd("i_usX2Y_Out04Int() urb %i status=%i\n", i, urb->status);
183 } 183 }
184#endif 184#endif
185} 185}
186 186
187static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs) 187static void i_usX2Y_In04Int(struct urb *urb, struct pt_regs *regs)
188{ 188{
189 int err = 0; 189 int err = 0;
190 usX2Ydev_t *usX2Y = urb->context; 190 struct usX2Ydev *usX2Y = urb->context;
191 us428ctls_sharedmem_t *us428ctls = usX2Y->us428ctls_sharedmem; 191 struct us428ctls_sharedmem *us428ctls = usX2Y->us428ctls_sharedmem;
192 192
193 usX2Y->In04IntCalls++; 193 usX2Y->In04IntCalls++;
194 194
@@ -239,10 +239,10 @@ static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs)
239 send = 0; 239 send = 0;
240 for (j = 0; j < URBS_AsyncSeq && !err; ++j) 240 for (j = 0; j < URBS_AsyncSeq && !err; ++j)
241 if (0 == usX2Y->AS04.urb[j]->status) { 241 if (0 == usX2Y->AS04.urb[j]->status) {
242 us428_p4out_t *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost. 242 struct us428_p4out *p4out = us428ctls->p4out + send; // FIXME if more then 1 p4out is new, 1 gets lost.
243 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev, 243 usb_fill_bulk_urb(usX2Y->AS04.urb[j], usX2Y->chip.dev,
244 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol, 244 usb_sndbulkpipe(usX2Y->chip.dev, 0x04), &p4out->val.vol,
245 p4out->type == eLT_Light ? sizeof(us428_lights_t) : 5, 245 p4out->type == eLT_Light ? sizeof(struct us428_lights) : 5,
246 i_usX2Y_Out04Int, usX2Y); 246 i_usX2Y_Out04Int, usX2Y);
247 err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC); 247 err = usb_submit_urb(usX2Y->AS04.urb[j], GFP_ATOMIC);
248 us428ctls->p4outSent = send; 248 us428ctls->p4outSent = send;
@@ -261,7 +261,7 @@ static void i_usX2Y_In04Int(struct urb* urb, struct pt_regs *regs)
261/* 261/*
262 * Prepare some urbs 262 * Prepare some urbs
263 */ 263 */
264int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y) 264int usX2Y_AsyncSeq04_init(struct usX2Ydev *usX2Y)
265{ 265{
266 int err = 0, 266 int err = 0,
267 i; 267 i;
@@ -283,9 +283,8 @@ int usX2Y_AsyncSeq04_init(usX2Ydev_t* usX2Y)
283 return err; 283 return err;
284} 284}
285 285
286int usX2Y_In04_init(usX2Ydev_t* usX2Y) 286int usX2Y_In04_init(struct usX2Ydev *usX2Y)
287{ 287{
288 int err = 0;
289 if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL))) 288 if (! (usX2Y->In04urb = usb_alloc_urb(0, GFP_KERNEL)))
290 return -ENOMEM; 289 return -ENOMEM;
291 290
@@ -299,11 +298,10 @@ int usX2Y_In04_init(usX2Ydev_t* usX2Y)
299 usX2Y->In04Buf, 21, 298 usX2Y->In04Buf, 21,
300 i_usX2Y_In04Int, usX2Y, 299 i_usX2Y_In04Int, usX2Y,
301 10); 300 10);
302 err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); 301 return usb_submit_urb(usX2Y->In04urb, GFP_KERNEL);
303 return err;
304} 302}
305 303
306static void usX2Y_unlinkSeq(snd_usX2Y_AsyncSeq_t* S) 304static void usX2Y_unlinkSeq(struct snd_usX2Y_AsyncSeq *S)
307{ 305{
308 int i; 306 int i;
309 for (i = 0; i < URBS_AsyncSeq; ++i) { 307 for (i = 0; i < URBS_AsyncSeq; ++i) {
@@ -336,16 +334,16 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = {
336 { /* terminator */ } 334 { /* terminator */ }
337}; 335};
338 336
339static snd_card_t* usX2Y_create_card(struct usb_device* device) 337static struct snd_card *usX2Y_create_card(struct usb_device *device)
340{ 338{
341 int dev; 339 int dev;
342 snd_card_t* card; 340 struct snd_card * card;
343 for (dev = 0; dev < SNDRV_CARDS; ++dev) 341 for (dev = 0; dev < SNDRV_CARDS; ++dev)
344 if (enable[dev] && !snd_usX2Y_card_used[dev]) 342 if (enable[dev] && !snd_usX2Y_card_used[dev])
345 break; 343 break;
346 if (dev >= SNDRV_CARDS) 344 if (dev >= SNDRV_CARDS)
347 return NULL; 345 return NULL;
348 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(usX2Ydev_t)); 346 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev));
349 if (!card) 347 if (!card)
350 return NULL; 348 return NULL;
351 snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; 349 snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1;
@@ -369,10 +367,10 @@ static snd_card_t* usX2Y_create_card(struct usb_device* device)
369} 367}
370 368
371 369
372static void* usX2Y_usb_probe(struct usb_device* device, struct usb_interface *intf, const struct usb_device_id* device_id) 370static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *intf, const struct usb_device_id *device_id)
373{ 371{
374 int err; 372 int err;
375 snd_card_t* card; 373 struct snd_card * card;
376 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || 374 if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 ||
377 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && 375 (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 &&
378 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && 376 le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 &&
@@ -415,7 +413,7 @@ static struct usb_driver snd_usX2Y_usb_driver = {
415 .id_table = snd_usX2Y_usb_id_table, 413 .id_table = snd_usX2Y_usb_id_table,
416}; 414};
417 415
418static void snd_usX2Y_card_private_free(snd_card_t *card) 416static void snd_usX2Y_card_private_free(struct snd_card *card)
419{ 417{
420 kfree(usX2Y(card)->In04Buf); 418 kfree(usX2Y(card)->In04Buf);
421 usb_free_urb(usX2Y(card)->In04urb); 419 usb_free_urb(usX2Y(card)->In04urb);
@@ -428,23 +426,24 @@ static void snd_usX2Y_card_private_free(snd_card_t *card)
428/* 426/*
429 * Frees the device. 427 * Frees the device.
430 */ 428 */
431static void usX2Y_usb_disconnect(struct usb_device* device, void* ptr) 429static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
432{ 430{
433 if (ptr) { 431 if (ptr) {
434 usX2Ydev_t* usX2Y = usX2Y((snd_card_t*)ptr); 432 struct snd_card *card = ptr;
435 struct list_head* p; 433 struct usX2Ydev *usX2Y = usX2Y(card);
434 struct list_head *p;
436 usX2Y->chip.shutdown = 1; 435 usX2Y->chip.shutdown = 1;
437 usX2Y->chip_status = USX2Y_STAT_CHIP_HUP; 436 usX2Y->chip_status = USX2Y_STAT_CHIP_HUP;
438 usX2Y_unlinkSeq(&usX2Y->AS04); 437 usX2Y_unlinkSeq(&usX2Y->AS04);
439 usb_kill_urb(usX2Y->In04urb); 438 usb_kill_urb(usX2Y->In04urb);
440 snd_card_disconnect((snd_card_t*)ptr); 439 snd_card_disconnect(card);
441 /* release the midi resources */ 440 /* release the midi resources */
442 list_for_each(p, &usX2Y->chip.midi_list) { 441 list_for_each(p, &usX2Y->chip.midi_list) {
443 snd_usbmidi_disconnect(p); 442 snd_usbmidi_disconnect(p);
444 } 443 }
445 if (usX2Y->us428ctls_sharedmem) 444 if (usX2Y->us428ctls_sharedmem)
446 wake_up(&usX2Y->us428ctls_wait_queue_head); 445 wake_up(&usX2Y->us428ctls_wait_queue_head);
447 snd_card_free((snd_card_t*)ptr); 446 snd_card_free(card);
448 } 447 }
449} 448}
450 449