diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/caiaq/caiaq-device.c | 22 | ||||
-rw-r--r-- | sound/usb/usbaudio.c | 27 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 1 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 22 | ||||
-rw-r--r-- | sound/usb/usbquirks.h | 8 | ||||
-rw-r--r-- | sound/usb/usx2y/us122l.c | 59 | ||||
-rw-r--r-- | sound/usb/usx2y/usX2Yhwdep.c | 15 | ||||
-rw-r--r-- | sound/usb/usx2y/usbusx2y.c | 56 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.h | 2 |
9 files changed, 110 insertions, 102 deletions
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index 41c36b055f6b..09aed2363cc9 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c | |||
@@ -336,9 +336,10 @@ static void __devinit setup_card(struct snd_usb_caiaqdev *dev) | |||
336 | log("Unable to set up control system (ret=%d)\n", ret); | 336 | log("Unable to set up control system (ret=%d)\n", ret); |
337 | } | 337 | } |
338 | 338 | ||
339 | static struct snd_card* create_card(struct usb_device* usb_dev) | 339 | static int create_card(struct usb_device* usb_dev, struct snd_card **cardp) |
340 | { | 340 | { |
341 | int devnum; | 341 | int devnum; |
342 | int err; | ||
342 | struct snd_card *card; | 343 | struct snd_card *card; |
343 | struct snd_usb_caiaqdev *dev; | 344 | struct snd_usb_caiaqdev *dev; |
344 | 345 | ||
@@ -347,12 +348,12 @@ static struct snd_card* create_card(struct usb_device* usb_dev) | |||
347 | break; | 348 | break; |
348 | 349 | ||
349 | if (devnum >= SNDRV_CARDS) | 350 | if (devnum >= SNDRV_CARDS) |
350 | return NULL; | 351 | return -ENODEV; |
351 | 352 | ||
352 | card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, | 353 | err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, |
353 | sizeof(struct snd_usb_caiaqdev)); | 354 | sizeof(struct snd_usb_caiaqdev), &card); |
354 | if (!card) | 355 | if (err < 0) |
355 | return NULL; | 356 | return err; |
356 | 357 | ||
357 | dev = caiaqdev(card); | 358 | dev = caiaqdev(card); |
358 | dev->chip.dev = usb_dev; | 359 | dev->chip.dev = usb_dev; |
@@ -362,7 +363,8 @@ static struct snd_card* create_card(struct usb_device* usb_dev) | |||
362 | spin_lock_init(&dev->spinlock); | 363 | spin_lock_init(&dev->spinlock); |
363 | snd_card_set_dev(card, &usb_dev->dev); | 364 | snd_card_set_dev(card, &usb_dev->dev); |
364 | 365 | ||
365 | return card; | 366 | *cardp = card; |
367 | return 0; | ||
366 | } | 368 | } |
367 | 369 | ||
368 | static int __devinit init_card(struct snd_usb_caiaqdev *dev) | 370 | static int __devinit init_card(struct snd_usb_caiaqdev *dev) |
@@ -441,10 +443,10 @@ static int __devinit snd_probe(struct usb_interface *intf, | |||
441 | struct snd_card *card; | 443 | struct snd_card *card; |
442 | struct usb_device *device = interface_to_usbdev(intf); | 444 | struct usb_device *device = interface_to_usbdev(intf); |
443 | 445 | ||
444 | card = create_card(device); | 446 | ret = create_card(device, &card); |
445 | 447 | ||
446 | if (!card) | 448 | if (ret < 0) |
447 | return -ENOMEM; | 449 | return ret; |
448 | 450 | ||
449 | usb_set_intfdata(intf, card); | 451 | usb_set_intfdata(intf, card); |
450 | ret = init_card(caiaqdev(card)); | 452 | ret = init_card(caiaqdev(card)); |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index defe9913cbb2..c2db0f959681 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2511,7 +2511,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2511 | * build the rate table and bitmap flags | 2511 | * build the rate table and bitmap flags |
2512 | */ | 2512 | */ |
2513 | int r, idx; | 2513 | int r, idx; |
2514 | unsigned int nonzero_rates = 0; | ||
2515 | 2514 | ||
2516 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); | 2515 | fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); |
2517 | if (fp->rate_table == NULL) { | 2516 | if (fp->rate_table == NULL) { |
@@ -2519,24 +2518,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform | |||
2519 | return -1; | 2518 | return -1; |
2520 | } | 2519 | } |
2521 | 2520 | ||
2522 | fp->nr_rates = nr_rates; | 2521 | fp->nr_rates = 0; |
2523 | fp->rate_min = fp->rate_max = combine_triple(&fmt[8]); | 2522 | fp->rate_min = fp->rate_max = 0; |
2524 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { | 2523 | for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) { |
2525 | unsigned int rate = combine_triple(&fmt[idx]); | 2524 | unsigned int rate = combine_triple(&fmt[idx]); |
2525 | if (!rate) | ||
2526 | continue; | ||
2526 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ | 2527 | /* C-Media CM6501 mislabels its 96 kHz altsetting */ |
2527 | if (rate == 48000 && nr_rates == 1 && | 2528 | if (rate == 48000 && nr_rates == 1 && |
2528 | chip->usb_id == USB_ID(0x0d8c, 0x0201) && | 2529 | (chip->usb_id == USB_ID(0x0d8c, 0x0201) || |
2530 | chip->usb_id == USB_ID(0x0d8c, 0x0102)) && | ||
2529 | fp->altsetting == 5 && fp->maxpacksize == 392) | 2531 | fp->altsetting == 5 && fp->maxpacksize == 392) |
2530 | rate = 96000; | 2532 | rate = 96000; |
2531 | fp->rate_table[r] = rate; | 2533 | fp->rate_table[fp->nr_rates] = rate; |
2532 | nonzero_rates |= rate; | 2534 | if (!fp->rate_min || rate < fp->rate_min) |
2533 | if (rate < fp->rate_min) | ||
2534 | fp->rate_min = rate; | 2535 | fp->rate_min = rate; |
2535 | else if (rate > fp->rate_max) | 2536 | if (!fp->rate_max || rate > fp->rate_max) |
2536 | fp->rate_max = rate; | 2537 | fp->rate_max = rate; |
2537 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); | 2538 | fp->rates |= snd_pcm_rate_to_rate_bit(rate); |
2539 | fp->nr_rates++; | ||
2538 | } | 2540 | } |
2539 | if (!nonzero_rates) { | 2541 | if (!fp->nr_rates) { |
2540 | hwc_debug("All rates were zero. Skipping format!\n"); | 2542 | hwc_debug("All rates were zero. Skipping format!\n"); |
2541 | return -1; | 2543 | return -1; |
2542 | } | 2544 | } |
@@ -2953,6 +2955,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, | |||
2953 | return -EINVAL; | 2955 | return -EINVAL; |
2954 | } | 2956 | } |
2955 | alts = &iface->altsetting[fp->altset_idx]; | 2957 | alts = &iface->altsetting[fp->altset_idx]; |
2958 | fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); | ||
2956 | usb_set_interface(chip->dev, fp->iface, 0); | 2959 | usb_set_interface(chip->dev, fp->iface, 0); |
2957 | init_usb_pitch(chip->dev, fp->iface, alts, fp); | 2960 | init_usb_pitch(chip->dev, fp->iface, alts, fp); |
2958 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); | 2961 | init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max); |
@@ -3450,10 +3453,10 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
3450 | return -ENXIO; | 3453 | return -ENXIO; |
3451 | } | 3454 | } |
3452 | 3455 | ||
3453 | card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0); | 3456 | err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card); |
3454 | if (card == NULL) { | 3457 | if (err < 0) { |
3455 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); | 3458 | snd_printk(KERN_ERR "cannot create card instance %d\n", idx); |
3456 | return -ENOMEM; | 3459 | return err; |
3457 | } | 3460 | } |
3458 | 3461 | ||
3459 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 3462 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 320641ab5be7..26bad373fe65 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | 1627 | ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; |
1628 | ep_info.out_interval = 0; | ||
1628 | ep_info.out_cables = endpoint->out_cables & 0x5555; | 1629 | ep_info.out_cables = endpoint->out_cables & 0x5555; |
1629 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); | 1630 | err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]); |
1630 | if (err < 0) | 1631 | if (err < 0) |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index 6615cd3b4079..ecb58e7a6245 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -79,7 +79,6 @@ struct usb_mixer_interface { | |||
79 | 79 | ||
80 | /* Sound Blaster remote control stuff */ | 80 | /* Sound Blaster remote control stuff */ |
81 | const struct rc_config *rc_cfg; | 81 | const struct rc_config *rc_cfg; |
82 | unsigned long rc_hwdep_open; | ||
83 | u32 rc_code; | 82 | u32 rc_code; |
84 | wait_queue_head_t rc_waitq; | 83 | wait_queue_head_t rc_waitq; |
85 | struct urb *rc_urb; | 84 | struct urb *rc_urb; |
@@ -1820,24 +1819,6 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb) | |||
1820 | wake_up(&mixer->rc_waitq); | 1819 | wake_up(&mixer->rc_waitq); |
1821 | } | 1820 | } |
1822 | 1821 | ||
1823 | static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
1824 | { | ||
1825 | struct usb_mixer_interface *mixer = hw->private_data; | ||
1826 | |||
1827 | if (test_and_set_bit(0, &mixer->rc_hwdep_open)) | ||
1828 | return -EBUSY; | ||
1829 | return 0; | ||
1830 | } | ||
1831 | |||
1832 | static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
1833 | { | ||
1834 | struct usb_mixer_interface *mixer = hw->private_data; | ||
1835 | |||
1836 | clear_bit(0, &mixer->rc_hwdep_open); | ||
1837 | smp_mb__after_clear_bit(); | ||
1838 | return 0; | ||
1839 | } | ||
1840 | |||
1841 | static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, | 1822 | static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf, |
1842 | long count, loff_t *offset) | 1823 | long count, loff_t *offset) |
1843 | { | 1824 | { |
@@ -1890,9 +1871,8 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | |||
1890 | hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; | 1871 | hwdep->iface = SNDRV_HWDEP_IFACE_SB_RC; |
1891 | hwdep->private_data = mixer; | 1872 | hwdep->private_data = mixer; |
1892 | hwdep->ops.read = snd_usb_sbrc_hwdep_read; | 1873 | hwdep->ops.read = snd_usb_sbrc_hwdep_read; |
1893 | hwdep->ops.open = snd_usb_sbrc_hwdep_open; | ||
1894 | hwdep->ops.release = snd_usb_sbrc_hwdep_release; | ||
1895 | hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; | 1874 | hwdep->ops.poll = snd_usb_sbrc_hwdep_poll; |
1875 | hwdep->exclusive = 1; | ||
1896 | 1876 | ||
1897 | mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); | 1877 | mixer->rc_urb = usb_alloc_urb(0, GFP_KERNEL); |
1898 | if (!mixer->rc_urb) | 1878 | if (!mixer->rc_urb) |
diff --git a/sound/usb/usbquirks.h b/sound/usb/usbquirks.h index d59323ecd571..647ef5029651 100644 --- a/sound/usb/usbquirks.h +++ b/sound/usb/usbquirks.h | |||
@@ -138,6 +138,14 @@ | |||
138 | .bInterfaceClass = USB_CLASS_AUDIO, | 138 | .bInterfaceClass = USB_CLASS_AUDIO, |
139 | .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL | 139 | .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL |
140 | }, | 140 | }, |
141 | { | ||
142 | USB_DEVICE(0x046d, 0x0990), | ||
143 | .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { | ||
144 | .vendor_name = "Logitech, Inc.", | ||
145 | .product_name = "QuickCam Pro 9000", | ||
146 | .ifnum = QUIRK_NO_INTERFACE | ||
147 | } | ||
148 | }, | ||
141 | 149 | ||
142 | /* | 150 | /* |
143 | * Yamaha devices | 151 | * Yamaha devices |
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c index 73e59f4403a4..98276aafefe6 100644 --- a/sound/usb/usx2y/us122l.c +++ b/sound/usb/usx2y/us122l.c | |||
@@ -478,19 +478,21 @@ static bool us122l_create_card(struct snd_card *card) | |||
478 | return true; | 478 | return true; |
479 | } | 479 | } |
480 | 480 | ||
481 | static struct snd_card *usx2y_create_card(struct usb_device *device) | 481 | static int usx2y_create_card(struct usb_device *device, struct snd_card **cardp) |
482 | { | 482 | { |
483 | int dev; | 483 | int dev; |
484 | struct snd_card *card; | 484 | struct snd_card *card; |
485 | int err; | ||
486 | |||
485 | for (dev = 0; dev < SNDRV_CARDS; ++dev) | 487 | for (dev = 0; dev < SNDRV_CARDS; ++dev) |
486 | if (enable[dev] && !snd_us122l_card_used[dev]) | 488 | if (enable[dev] && !snd_us122l_card_used[dev]) |
487 | break; | 489 | break; |
488 | if (dev >= SNDRV_CARDS) | 490 | if (dev >= SNDRV_CARDS) |
489 | return NULL; | 491 | return -ENODEV; |
490 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 492 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
491 | sizeof(struct us122l)); | 493 | sizeof(struct us122l), &card); |
492 | if (!card) | 494 | if (err < 0) |
493 | return NULL; | 495 | return err; |
494 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; | 496 | snd_us122l_card_used[US122L(card)->chip.index = dev] = 1; |
495 | 497 | ||
496 | US122L(card)->chip.dev = device; | 498 | US122L(card)->chip.dev = device; |
@@ -509,46 +511,57 @@ static struct snd_card *usx2y_create_card(struct usb_device *device) | |||
509 | US122L(card)->chip.dev->devnum | 511 | US122L(card)->chip.dev->devnum |
510 | ); | 512 | ); |
511 | snd_card_set_dev(card, &device->dev); | 513 | snd_card_set_dev(card, &device->dev); |
512 | return card; | 514 | *cardp = card; |
515 | return 0; | ||
513 | } | 516 | } |
514 | 517 | ||
515 | static void *us122l_usb_probe(struct usb_interface *intf, | 518 | static int us122l_usb_probe(struct usb_interface *intf, |
516 | const struct usb_device_id *device_id) | 519 | const struct usb_device_id *device_id, |
520 | struct snd_card **cardp) | ||
517 | { | 521 | { |
518 | struct usb_device *device = interface_to_usbdev(intf); | 522 | struct usb_device *device = interface_to_usbdev(intf); |
519 | struct snd_card *card = usx2y_create_card(device); | 523 | struct snd_card *card; |
524 | int err; | ||
520 | 525 | ||
521 | if (!card) | 526 | err = usx2y_create_card(device, &card); |
522 | return NULL; | 527 | if (err < 0) |
528 | return err; | ||
523 | 529 | ||
524 | if (!us122l_create_card(card) || | 530 | if (!us122l_create_card(card)) { |
525 | snd_card_register(card) < 0) { | ||
526 | snd_card_free(card); | 531 | snd_card_free(card); |
527 | return NULL; | 532 | return -EINVAL; |
533 | } | ||
534 | |||
535 | err = snd_card_register(card); | ||
536 | if (err < 0) { | ||
537 | snd_card_free(card); | ||
538 | return err; | ||
528 | } | 539 | } |
529 | 540 | ||
530 | usb_get_dev(device); | 541 | usb_get_dev(device); |
531 | return card; | 542 | *cardp = card; |
543 | return 0; | ||
532 | } | 544 | } |
533 | 545 | ||
534 | static int snd_us122l_probe(struct usb_interface *intf, | 546 | static int snd_us122l_probe(struct usb_interface *intf, |
535 | const struct usb_device_id *id) | 547 | const struct usb_device_id *id) |
536 | { | 548 | { |
537 | struct snd_card *card; | 549 | struct snd_card *card; |
550 | int err; | ||
551 | |||
538 | snd_printdd(KERN_DEBUG"%p:%i\n", | 552 | snd_printdd(KERN_DEBUG"%p:%i\n", |
539 | intf, intf->cur_altsetting->desc.bInterfaceNumber); | 553 | intf, intf->cur_altsetting->desc.bInterfaceNumber); |
540 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) | 554 | if (intf->cur_altsetting->desc.bInterfaceNumber != 1) |
541 | return 0; | 555 | return 0; |
542 | 556 | ||
543 | card = us122l_usb_probe(usb_get_intf(intf), id); | 557 | err = us122l_usb_probe(usb_get_intf(intf), id, &card); |
544 | 558 | if (err < 0) { | |
545 | if (card) { | 559 | usb_put_intf(intf); |
546 | usb_set_intfdata(intf, card); | 560 | return err; |
547 | return 0; | ||
548 | } | 561 | } |
549 | 562 | ||
550 | usb_put_intf(intf); | 563 | usb_set_intfdata(intf, card); |
551 | return -EIO; | 564 | return 0; |
552 | } | 565 | } |
553 | 566 | ||
554 | static void snd_us122l_disconnect(struct usb_interface *intf) | 567 | static void snd_us122l_disconnect(struct usb_interface *intf) |
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c index 1558a5c4094f..4af8740db717 100644 --- a/sound/usb/usx2y/usX2Yhwdep.c +++ b/sound/usb/usx2y/usX2Yhwdep.c | |||
@@ -30,9 +30,6 @@ | |||
30 | #include "usbusx2y.h" | 30 | #include "usbusx2y.h" |
31 | #include "usX2Yhwdep.h" | 31 | #include "usX2Yhwdep.h" |
32 | 32 | ||
33 | int usX2Y_hwdep_pcm_new(struct snd_card *card); | ||
34 | |||
35 | |||
36 | static int snd_us428ctls_vm_fault(struct vm_area_struct *area, | 33 | static int snd_us428ctls_vm_fault(struct vm_area_struct *area, |
37 | struct vm_fault *vmf) | 34 | struct vm_fault *vmf) |
38 | { | 35 | { |
@@ -106,16 +103,6 @@ static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, | |||
106 | } | 103 | } |
107 | 104 | ||
108 | 105 | ||
109 | static int snd_usX2Y_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
110 | { | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int snd_usX2Y_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
115 | { | ||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, | 106 | static int snd_usX2Y_hwdep_dsp_status(struct snd_hwdep *hw, |
120 | struct snd_hwdep_dsp_status *info) | 107 | struct snd_hwdep_dsp_status *info) |
121 | { | 108 | { |
@@ -267,8 +254,6 @@ int usX2Y_hwdep_new(struct snd_card *card, struct usb_device* device) | |||
267 | 254 | ||
268 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y; | 255 | hw->iface = SNDRV_HWDEP_IFACE_USX2Y; |
269 | hw->private_data = usX2Y(card); | 256 | hw->private_data = usX2Y(card); |
270 | hw->ops.open = snd_usX2Y_hwdep_open; | ||
271 | hw->ops.release = snd_usX2Y_hwdep_release; | ||
272 | hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; | 257 | hw->ops.dsp_status = snd_usX2Y_hwdep_dsp_status; |
273 | hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; | 258 | hw->ops.dsp_load = snd_usX2Y_hwdep_dsp_load; |
274 | hw->ops.mmap = snd_us428ctls_mmap; | 259 | hw->ops.mmap = snd_us428ctls_mmap; |
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c index 11639bd72a51..5ce0da23ee96 100644 --- a/sound/usb/usx2y/usbusx2y.c +++ b/sound/usb/usx2y/usbusx2y.c | |||
@@ -227,9 +227,9 @@ static void i_usX2Y_In04Int(struct urb *urb) | |||
227 | 227 | ||
228 | if (usX2Y->US04) { | 228 | if (usX2Y->US04) { |
229 | if (0 == usX2Y->US04->submitted) | 229 | if (0 == usX2Y->US04->submitted) |
230 | do | 230 | do { |
231 | err = usb_submit_urb(usX2Y->US04->urb[usX2Y->US04->submitted++], GFP_ATOMIC); | 231 | err = usb_submit_urb(usX2Y->US04->urb[usX2Y->US04->submitted++], GFP_ATOMIC); |
232 | while (!err && usX2Y->US04->submitted < usX2Y->US04->len); | 232 | } while (!err && usX2Y->US04->submitted < usX2Y->US04->len); |
233 | } else | 233 | } else |
234 | if (us428ctls && us428ctls->p4outLast >= 0 && us428ctls->p4outLast < N_us428_p4out_BUFS) { | 234 | if (us428ctls && us428ctls->p4outLast >= 0 && us428ctls->p4outLast < N_us428_p4out_BUFS) { |
235 | if (us428ctls->p4outLast != us428ctls->p4outSent) { | 235 | if (us428ctls->p4outLast != us428ctls->p4outSent) { |
@@ -333,18 +333,21 @@ static struct usb_device_id snd_usX2Y_usb_id_table[] = { | |||
333 | { /* terminator */ } | 333 | { /* terminator */ } |
334 | }; | 334 | }; |
335 | 335 | ||
336 | static struct snd_card *usX2Y_create_card(struct usb_device *device) | 336 | static int usX2Y_create_card(struct usb_device *device, struct snd_card **cardp) |
337 | { | 337 | { |
338 | int dev; | 338 | int dev; |
339 | struct snd_card * card; | 339 | struct snd_card * card; |
340 | int err; | ||
341 | |||
340 | for (dev = 0; dev < SNDRV_CARDS; ++dev) | 342 | for (dev = 0; dev < SNDRV_CARDS; ++dev) |
341 | if (enable[dev] && !snd_usX2Y_card_used[dev]) | 343 | if (enable[dev] && !snd_usX2Y_card_used[dev]) |
342 | break; | 344 | break; |
343 | if (dev >= SNDRV_CARDS) | 345 | if (dev >= SNDRV_CARDS) |
344 | return NULL; | 346 | return -ENODEV; |
345 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct usX2Ydev)); | 347 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
346 | if (!card) | 348 | sizeof(struct usX2Ydev), &card); |
347 | return NULL; | 349 | if (err < 0) |
350 | return err; | ||
348 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; | 351 | snd_usX2Y_card_used[usX2Y(card)->chip.index = dev] = 1; |
349 | card->private_free = snd_usX2Y_card_private_free; | 352 | card->private_free = snd_usX2Y_card_private_free; |
350 | usX2Y(card)->chip.dev = device; | 353 | usX2Y(card)->chip.dev = device; |
@@ -362,26 +365,36 @@ static struct snd_card *usX2Y_create_card(struct usb_device *device) | |||
362 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum | 365 | usX2Y(card)->chip.dev->bus->busnum, usX2Y(card)->chip.dev->devnum |
363 | ); | 366 | ); |
364 | snd_card_set_dev(card, &device->dev); | 367 | snd_card_set_dev(card, &device->dev); |
365 | return card; | 368 | *cardp = card; |
369 | return 0; | ||
366 | } | 370 | } |
367 | 371 | ||
368 | 372 | ||
369 | static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *intf, const struct usb_device_id *device_id) | 373 | static int usX2Y_usb_probe(struct usb_device *device, |
374 | struct usb_interface *intf, | ||
375 | const struct usb_device_id *device_id, | ||
376 | struct snd_card **cardp) | ||
370 | { | 377 | { |
371 | int err; | 378 | int err; |
372 | struct snd_card * card; | 379 | struct snd_card * card; |
380 | |||
381 | *cardp = NULL; | ||
373 | if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || | 382 | if (le16_to_cpu(device->descriptor.idVendor) != 0x1604 || |
374 | (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && | 383 | (le16_to_cpu(device->descriptor.idProduct) != USB_ID_US122 && |
375 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && | 384 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US224 && |
376 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428) || | 385 | le16_to_cpu(device->descriptor.idProduct) != USB_ID_US428)) |
377 | !(card = usX2Y_create_card(device))) | 386 | return -EINVAL; |
378 | return NULL; | 387 | |
388 | err = usX2Y_create_card(device, &card); | ||
389 | if (err < 0) | ||
390 | return err; | ||
379 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || | 391 | if ((err = usX2Y_hwdep_new(card, device)) < 0 || |
380 | (err = snd_card_register(card)) < 0) { | 392 | (err = snd_card_register(card)) < 0) { |
381 | snd_card_free(card); | 393 | snd_card_free(card); |
382 | return NULL; | 394 | return err; |
383 | } | 395 | } |
384 | return card; | 396 | *cardp = card; |
397 | return 0; | ||
385 | } | 398 | } |
386 | 399 | ||
387 | /* | 400 | /* |
@@ -389,13 +402,14 @@ static void *usX2Y_usb_probe(struct usb_device *device, struct usb_interface *in | |||
389 | */ | 402 | */ |
390 | static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) | 403 | static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_id *id) |
391 | { | 404 | { |
392 | void *chip; | 405 | struct snd_card *card; |
393 | chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); | 406 | int err; |
394 | if (chip) { | 407 | |
395 | usb_set_intfdata(intf, chip); | 408 | err = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id, &card); |
396 | return 0; | 409 | if (err < 0) |
397 | } else | 410 | return err; |
398 | return -EIO; | 411 | dev_set_drvdata(&intf->dev, card); |
412 | return 0; | ||
399 | } | 413 | } |
400 | 414 | ||
401 | static void snd_usX2Y_disconnect(struct usb_interface *intf) | 415 | static void snd_usX2Y_disconnect(struct usb_interface *intf) |
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.h b/sound/usb/usx2y/usx2yhwdeppcm.h index c3382fdc386b..9c4fb84b2aa0 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.h +++ b/sound/usb/usx2y/usx2yhwdeppcm.h | |||
@@ -18,3 +18,5 @@ struct snd_usX2Y_hwdep_pcm_shm { | |||
18 | volatile unsigned captured_iso_frames; | 18 | volatile unsigned captured_iso_frames; |
19 | int capture_iso_start; | 19 | int capture_iso_start; |
20 | }; | 20 | }; |
21 | |||
22 | int usX2Y_hwdep_pcm_new(struct snd_card *card); | ||