From: Takashi Iwai Date: Wed, 25 Apr 2018 08:41:08 +0000 (+0200) Subject: Merge branch 'for-linus' into for-next X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4d31c6e41ed2f95f97a19766812797dabd82a5ee;p=linux.git Merge branch 'for-linus' into for-next Back-merge 4.17-rc3 fixes for further development. This will bump the base to 4.17-rc2, too. Signed-off-by: Takashi Iwai --- 4d31c6e41ed2f95f97a19766812797dabd82a5ee diff --cc sound/core/pcm_native.c index 7585444352df8,0e875d5a9e862..8ae42be160ae2 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@@ -2654,17 -2692,26 +2654,20 @@@ static int snd_pcm_hwsync(struct snd_pc return err; } - static snd_pcm_sframes_t snd_pcm_delay(struct snd_pcm_substream *substream) + static int snd_pcm_delay(struct snd_pcm_substream *substream, + snd_pcm_sframes_t *delay) { - struct snd_pcm_runtime *runtime = substream->runtime; int err; snd_pcm_sframes_t n = 0; snd_pcm_stream_lock_irq(substream); err = do_pcm_hwsync(substream); - if (!err) { - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) - n = snd_pcm_playback_hw_avail(runtime); - else - n = snd_pcm_capture_avail(runtime); - n += runtime->delay; - } + if (!err) + n = snd_pcm_calc_delay(substream); snd_pcm_stream_unlock_irq(substream); - return err < 0 ? err : n; + if (!err) + *delay = n; + return err; } static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream,