static int atmel_classd_cpu_dai_startup(struct snd_pcm_substream *substream,
                                        struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
        int err;
 
        struct snd_pcm_hw_params *params,
        struct dma_slave_config *slave_config)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
 
        if (params_physical_width(params) != 16) {
                               struct snd_pcm_hw_params *params,
                               struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
        struct snd_soc_component *component = cpu_dai->component;
        int fs;
 atmel_classd_cpu_dai_shutdown(struct snd_pcm_substream *substream,
                              struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
 
        clk_disable_unprepare(dd->gclk);
 
 static void atmel_pcm_dma_irq(u32 ssc_sr,
        struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pcm_dma_params *prtd;
 
        prtd = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
 static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream,
        struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pcm_dma_params *prtd;
        struct ssc_device *ssc;
        int ret;
 
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct atmel_runtime_data *prtd = runtime->private_data;
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 
        /* this may get called several times by oss emulation
         * with different params */
 
 static int atmel_pdmic_cpu_dai_startup(struct snd_pcm_substream *substream,
                                        struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card);
        int ret;
 
 static void atmel_pdmic_cpu_dai_shutdown(struct snd_pcm_substream *substream,
                                        struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card);
 
        /* Disable the overrun error interrupt */
 static int atmel_pdmic_cpu_dai_prepare(struct snd_pcm_substream *substream,
                                        struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card);
        struct snd_soc_component *component = cpu_dai->component;
        u32 val;
                                struct snd_pcm_hw_params *params,
                                struct dma_slave_config *slave_config)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card);
        int ret;
 
                              struct snd_pcm_hw_params *params,
                              struct snd_soc_dai *cpu_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct atmel_pdmic *dd = snd_soc_card_get_drvdata(rtd->card);
        struct snd_soc_component *component = cpu_dai->component;
        unsigned int rate_min = substream->runtime->hw.rate_min;
 
 static int atmel_asoc_wm8904_hw_params(struct snd_pcm_substream *substream,
                struct snd_pcm_hw_params *params)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
        int ret;