diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-11-23 09:53:37 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-11-23 15:16:13 +0100 |
commit | 3d58760f4d0015cc1e7765b580daa007d759d86b (patch) | |
tree | bca1eab6c6df12e77c1f98f0f46992fa4528ae30 /sound/usb/pcm.c | |
parent | ALSA: usb-audio: Drop unneeded snd_usb_substream fields (diff) | |
download | linux-3d58760f4d0015cc1e7765b580daa007d759d86b.tar.xz linux-3d58760f4d0015cc1e7765b580daa007d759d86b.zip |
ALSA: usb-audio: Unify the code for the next packet size calculation
There are two places calculating the next packet size for the playback
stream in the exactly same way. Provide the single helper for this
purpose and use it from both places gracefully.
Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-32-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 95a6a854dc55..5953e22a72c5 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -1512,13 +1512,7 @@ static void prepare_playback_urb(struct snd_usb_substream *subs, spin_lock_irqsave(&subs->lock, flags); subs->frame_limit += ep->max_urb_frames; for (i = 0; i < ctx->packets; i++) { - if (ctx->packet_size[i]) - counts = ctx->packet_size[i]; - else if (ep->sync_master) - counts = snd_usb_endpoint_slave_next_packet_size(ep); - else - counts = snd_usb_endpoint_next_packet_size(ep); - + counts = snd_usb_endpoint_next_packet_size(ep, ctx, i); /* set up descriptor */ urb->iso_frame_desc[i].offset = frames * ep->stride; urb->iso_frame_desc[i].length = counts * ep->stride; |