aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/stream.c')
-rw-r--r--sound/usb/stream.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index ad181d538bd9..7db2f8958e79 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -42,12 +42,11 @@
42 */ 42 */
43static void free_substream(struct snd_usb_substream *subs) 43static void free_substream(struct snd_usb_substream *subs)
44{ 44{
45 struct list_head *p, *n; 45 struct audioformat *fp, *n;
46 46
47 if (!subs->num_formats) 47 if (!subs->num_formats)
48 return; /* not initialized */ 48 return; /* not initialized */
49 list_for_each_safe(p, n, &subs->fmt_list) { 49 list_for_each_entry_safe(fp, n, &subs->fmt_list, list) {
50 struct audioformat *fp = list_entry(p, struct audioformat, list);
51 kfree(fp->rate_table); 50 kfree(fp->rate_table);
52 kfree(fp->chmap); 51 kfree(fp->chmap);
53 kfree(fp); 52 kfree(fp);
@@ -94,6 +93,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
94 subs->dev = as->chip->dev; 93 subs->dev = as->chip->dev;
95 subs->txfr_quirk = as->chip->txfr_quirk; 94 subs->txfr_quirk = as->chip->txfr_quirk;
96 subs->speed = snd_usb_get_speed(subs->dev); 95 subs->speed = snd_usb_get_speed(subs->dev);
96 subs->pkt_offset_adj = 0;
97 97
98 snd_usb_set_pcm_ops(as->pcm, stream); 98 snd_usb_set_pcm_ops(as->pcm, stream);
99 99
@@ -313,14 +313,12 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
313 int stream, 313 int stream,
314 struct audioformat *fp) 314 struct audioformat *fp)
315{ 315{
316 struct list_head *p;
317 struct snd_usb_stream *as; 316 struct snd_usb_stream *as;
318 struct snd_usb_substream *subs; 317 struct snd_usb_substream *subs;
319 struct snd_pcm *pcm; 318 struct snd_pcm *pcm;
320 int err; 319 int err;
321 320
322 list_for_each(p, &chip->pcm_list) { 321 list_for_each_entry(as, &chip->pcm_list, list) {
323 as = list_entry(p, struct snd_usb_stream, list);
324 if (as->fmt_type != fp->fmt_type) 322 if (as->fmt_type != fp->fmt_type)
325 continue; 323 continue;
326 subs = &as->substream[stream]; 324 subs = &as->substream[stream];
@@ -332,8 +330,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
332 } 330 }
333 } 331 }
334 /* look for an empty stream */ 332 /* look for an empty stream */
335 list_for_each(p, &chip->pcm_list) { 333 list_for_each_entry(as, &chip->pcm_list, list) {
336 as = list_entry(p, struct snd_usb_stream, list);
337 if (as->fmt_type != fp->fmt_type) 334 if (as->fmt_type != fp->fmt_type)
338 continue; 335 continue;
339 subs = &as->substream[stream]; 336 subs = &as->substream[stream];
@@ -396,6 +393,14 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
396 if (!csep && altsd->bNumEndpoints >= 2) 393 if (!csep && altsd->bNumEndpoints >= 2)
397 csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); 394 csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT);
398 395
396 /*
397 * If we can't locate the USB_DT_CS_ENDPOINT descriptor in the extra
398 * bytes after the first endpoint, go search the entire interface.
399 * Some devices have it directly *before* the standard endpoint.
400 */
401 if (!csep)
402 csep = snd_usb_find_desc(alts->extra, alts->extralen, NULL, USB_DT_CS_ENDPOINT);
403
399 if (!csep || csep->bLength < 7 || 404 if (!csep || csep->bLength < 7 ||
400 csep->bDescriptorSubtype != UAC_EP_GENERAL) { 405 csep->bDescriptorSubtype != UAC_EP_GENERAL) {
401 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" 406 snd_printk(KERN_WARNING "%d:%u:%d : no or invalid"
@@ -463,7 +468,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
463 struct usb_host_interface *alts; 468 struct usb_host_interface *alts;
464 struct usb_interface_descriptor *altsd; 469 struct usb_interface_descriptor *altsd;
465 int i, altno, err, stream; 470 int i, altno, err, stream;
466 int format = 0, num_channels = 0; 471 unsigned int format = 0, num_channels = 0;
467 struct audioformat *fp = NULL; 472 struct audioformat *fp = NULL;
468 int num, protocol, clock = 0; 473 int num, protocol, clock = 0;
469 struct uac_format_type_i_continuous_descriptor *fmt; 474 struct uac_format_type_i_continuous_descriptor *fmt;