diff options
author | Andrej Krutak <dev@andree.sk> | 2016-09-18 20:59:21 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-09-19 22:58:08 +0200 |
commit | b2233d97a0e64aa1f0557ffb409c957748ae7f3a (patch) | |
tree | c32250cec2955d94c2a05010151c19fb3bc6884c /sound/usb/line6/capture.c | |
parent | ALSA: compress: fix some missing and misplaced \n in messages (diff) | |
download | linux-b2233d97a0e64aa1f0557ffb409c957748ae7f3a.tar.xz linux-b2233d97a0e64aa1f0557ffb409c957748ae7f3a.zip |
ALSA: line6: Enable different number of URBs for frame transfers
This basically changes LINE6_ISO_BUFFERS constant to a configurable
iso_buffers property.
Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/capture.c')
-rw-r--r-- | sound/usb/line6/capture.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c index f518fbbe88de..c2808a0b771a 100644 --- a/sound/usb/line6/capture.c +++ b/sound/usb/line6/capture.c @@ -29,10 +29,10 @@ static int submit_audio_in_urb(struct snd_line6_pcm *line6pcm) int ret; struct urb *urb_in; - index = - find_first_zero_bit(&line6pcm->in.active_urbs, LINE6_ISO_BUFFERS); + index = find_first_zero_bit(&line6pcm->in.active_urbs, + line6pcm->line6->iso_buffers); - if (index < 0 || index >= LINE6_ISO_BUFFERS) { + if (index < 0 || index >= line6pcm->line6->iso_buffers) { dev_err(line6pcm->line6->ifcdev, "no free URB found\n"); return -EINVAL; } @@ -73,7 +73,7 @@ int line6_submit_audio_in_all_urbs(struct snd_line6_pcm *line6pcm) { int ret = 0, i; - for (i = 0; i < LINE6_ISO_BUFFERS; ++i) { + for (i = 0; i < line6pcm->line6->iso_buffers; ++i) { ret = submit_audio_in_urb(line6pcm); if (ret < 0) break; @@ -154,7 +154,7 @@ static void audio_in_callback(struct urb *urb) line6pcm->in.last_frame = urb->start_frame; /* find index of URB */ - for (index = 0; index < LINE6_ISO_BUFFERS; ++index) + for (index = 0; index < line6pcm->line6->iso_buffers; ++index) if (urb == line6pcm->in.urbs[index]) break; @@ -247,8 +247,13 @@ int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm) struct usb_line6 *line6 = line6pcm->line6; int i; + line6pcm->in.urbs = kzalloc( + sizeof(struct urb *) * line6->iso_buffers, GFP_KERNEL); + if (line6pcm->in.urbs == NULL) + return -ENOMEM; + /* create audio URBs and fill in constant values: */ - for (i = 0; i < LINE6_ISO_BUFFERS; ++i) { + for (i = 0; i < line6->iso_buffers; ++i) { struct urb *urb; /* URB for audio in: */ |