return ret;
 }
 
+static snd_pcm_uframes_t dmaengine_pcm_pointer(
+       struct snd_pcm_substream *substream)
+{
+       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
+
+       if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
+               return snd_dmaengine_pcm_pointer_no_residue(substream);
+       else
+               return snd_dmaengine_pcm_pointer(substream);
+}
+
 static const struct snd_pcm_ops dmaengine_pcm_ops = {
        .open           = dmaengine_pcm_open,
        .close          = snd_dmaengine_pcm_close,
        .hw_params      = dmaengine_pcm_hw_params,
        .hw_free        = snd_pcm_lib_free_pages,
        .trigger        = snd_dmaengine_pcm_trigger,
-       .pointer        = snd_dmaengine_pcm_pointer,
+       .pointer        = dmaengine_pcm_pointer,
 };
 
 static const struct snd_soc_platform_driver dmaengine_pcm_platform = {
        .probe_order    = SND_SOC_COMP_ORDER_LATE,
 };
 
-static const struct snd_pcm_ops dmaengine_no_residue_pcm_ops = {
-       .open           = dmaengine_pcm_open,
-       .close          = snd_dmaengine_pcm_close,
-       .ioctl          = snd_pcm_lib_ioctl,
-       .hw_params      = dmaengine_pcm_hw_params,
-       .hw_free        = snd_pcm_lib_free_pages,
-       .trigger        = snd_dmaengine_pcm_trigger,
-       .pointer        = snd_dmaengine_pcm_pointer_no_residue,
-};
-
-static const struct snd_soc_platform_driver dmaengine_no_residue_pcm_platform = {
-       .ops            = &dmaengine_no_residue_pcm_ops,
-       .pcm_new        = dmaengine_pcm_new,
-       .pcm_free       = dmaengine_pcm_free,
-       .probe_order    = SND_SOC_COMP_ORDER_LATE,
-};
-
 static const char * const dmaengine_pcm_dma_channel_names[] = {
        [SNDRV_PCM_STREAM_PLAYBACK] = "tx",
        [SNDRV_PCM_STREAM_CAPTURE] = "rx",
        if (ret)
                goto err_free_dma;
 
-       if (flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
-               ret = snd_soc_add_platform(dev, &pcm->platform,
-                               &dmaengine_no_residue_pcm_platform);
-       else
-               ret = snd_soc_add_platform(dev, &pcm->platform,
-                               &dmaengine_pcm_platform);
+       ret = snd_soc_add_platform(dev, &pcm->platform,
+               &dmaengine_pcm_platform);
        if (ret)
                goto err_free_dma;