static int snd_pcm_delay(struct snd_pcm_substream *substream,
			 snd_pcm_sframes_t *delay)
{
	int err;

	snd_pcm_stream_lock_irq(substream);
	err = do_pcm_hwsync(substream);
	if (delay && !err)
		*delay = snd_pcm_calc_delay(substream);
	snd_pcm_stream_unlock_irq(substream);
	snd_pcm_dma_buffer_sync(substream, SNDRV_DMA_SYNC_CPU);

	return err;
}
static int snd_pcm_delay(struct snd_pcm_substream *substream,
			 snd_pcm_sframes_t *delay)
{
	int err;

	snd_pcm_stream_lock_irq(substream);
	err = do_pcm_hwsync(substream);
	if (delay && !err)
		*delay = snd_pcm_calc_delay(substream);
	snd_pcm_stream_unlock_irq(substream);
	snd_pcm_dma_buffer_sync(substream, SNDRV_DMA_SYNC_CPU);

	return err;
}