summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorRicard Wanderlof <ricard.wanderlof@axis.com>2015-10-19 08:52:50 +0200
committerTakashi Iwai <tiwai@suse.de>2015-10-19 12:38:07 +0200
commit4c4e4391b833e6297e0a6bc43db023a8c55d6835 (patch)
tree64979aa6112318ec77a1afa8e4ae5b2d999e70e6 /sound/usb
parentALSA: USB-audio: Break out copying to urb from prepare_playback_urb() (diff)
downloadlinux-4c4e4391b833e6297e0a6bc43db023a8c55d6835.tar.xz
linux-4c4e4391b833e6297e0a6bc43db023a8c55d6835.zip
ALSA: USB-audio: Also move out hwptr_done wrap from prepare_playback_urb()
Refactoring in preparation for adding Zoom R16/24 quirk. No functional change. Signed-off-by: Ricard Wanderlof <ricardw@axis.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/pcm.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 4292bad9f320..ee8dd9efb3ef 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1383,6 +1383,8 @@ static inline void fill_playback_urb_dsd_dop(struct snd_usb_substream *subs,
subs->hwptr_done++;
}
}
+ if (subs->hwptr_done >= runtime->buffer_size * stride)
+ subs->hwptr_done -= runtime->buffer_size * stride;
}
static void copy_to_urb(struct snd_usb_substream *subs,
@@ -1403,6 +1405,8 @@ static void copy_to_urb(struct snd_usb_substream *subs,
runtime->dma_area + subs->hwptr_done, bytes);
}
subs->hwptr_done += bytes;
+ if (subs->hwptr_done >= runtime->buffer_size * stride)
+ subs->hwptr_done -= runtime->buffer_size * stride;
}
static void prepare_playback_urb(struct snd_usb_substream *subs,
@@ -1480,14 +1484,13 @@ static void prepare_playback_urb(struct snd_usb_substream *subs,
}
subs->hwptr_done += bytes;
+ if (subs->hwptr_done >= runtime->buffer_size * stride)
+ subs->hwptr_done -= runtime->buffer_size * stride;
} else {
/* usual PCM */
copy_to_urb(subs, urb, stride, bytes);
}
- if (subs->hwptr_done >= runtime->buffer_size * stride)
- subs->hwptr_done -= runtime->buffer_size * stride;
-
/* update delay with exact number of samples queued */
runtime->delay = subs->last_delay;
runtime->delay += frames;