struct snd_pcm_substream *substream, int cmd);
 int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai,
                        struct snd_pcm_substream *substream, int cmd);
+snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
+                                   struct snd_pcm_substream *substream);
 
 struct snd_soc_dai_ops {
        /*
 
 
        return ret;
 }
+
+snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai,
+                                   struct snd_pcm_substream *substream)
+{
+       int delay = 0;
+
+       if (dai->driver->ops->delay)
+               delay = dai->driver->ops->delay(substream, dai);
+
+       return delay;
+}
 
        /* base delay if assigned in pointer callback */
        delay = runtime->delay;
 
-       if (cpu_dai->driver->ops->delay)
-               delay += cpu_dai->driver->ops->delay(substream, cpu_dai);
+       delay += snd_soc_dai_delay(cpu_dai, substream);
 
        for_each_rtd_codec_dai(rtd, i, codec_dai) {
-               if (codec_dai->driver->ops->delay)
-                       codec_delay = max(codec_delay,
-                                       codec_dai->driver->ops->delay(substream,
-                                                                   codec_dai));
+               codec_delay = max(codec_delay,
+                                 snd_soc_dai_delay(codec_dai, substream));
        }
        delay += codec_delay;