]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
ASoC: soc-xxx: add asoc_substream_to_rtd()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 20 Jul 2020 01:17:39 +0000 (10:17 +0900)
committerMark Brown <broonie@kernel.org>
Thu, 23 Jul 2020 18:07:19 +0000 (19:07 +0100)
Current soc-xxx are getting rtd from substream by

rtd = substream->private_data;

But, getting data from "private_data" is very unclear.
This patch adds asoc_substream_to_rtd() macro which is
easy to understand that rtd from substream.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wo2z0yve.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/soc.h
sound/soc/soc-component.c
sound/soc/soc-dai.c
sound/soc/soc-dapm.c
sound/soc/soc-generic-dmaengine-pcm.c
sound/soc/soc-link.c
sound/soc/soc-pcm.c
sound/soc/soc-utils.c

index 59235e553630654a25d566226b1c4b371c5ad09a..acbb5efb28ef99e3dc53b7cfea94c195a0d19305 100644 (file)
@@ -1168,6 +1168,8 @@ struct snd_soc_pcm_runtime {
 /* see soc_new_pcm_runtime()  */
 #define asoc_rtd_to_cpu(rtd, n)   (rtd)->dais[n]
 #define asoc_rtd_to_codec(rtd, n) (rtd)->dais[n + (rtd)->num_cpus]
+#define asoc_substream_to_rtd(substream) \
+       (struct snd_soc_pcm_runtime *)snd_pcm_substream_chip(substream)
 
 #define for_each_rtd_components(rtd, i, component)                     \
        for ((i) = 0, component = NULL;                                 \
index 9565a0dd7cb6301bd5355daea9113361f00cab9e..c1b799f984604ecf4c7f3054ac8276e486107bf5 100644 (file)
@@ -606,7 +606,7 @@ EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
 
 int snd_soc_pcm_component_pointer(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 snd_soc_component *component;
        int i;
 
@@ -621,7 +621,7 @@ int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream)
 int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
                                unsigned int cmd, void *arg)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i;
 
@@ -638,7 +638,7 @@ int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
 
 int snd_soc_pcm_component_sync_stop(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 snd_soc_component *component;
        int i, ret;
 
@@ -658,7 +658,7 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
                                    int channel, unsigned long pos,
                                    void __user *buf, unsigned long bytes)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i;
 
@@ -677,7 +677,7 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
 struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
                                        unsigned long offset)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        struct page *page;
        int i;
@@ -698,7 +698,7 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
 int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
                               struct vm_area_struct *vma)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i;
 
@@ -745,7 +745,7 @@ void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
 
 int snd_soc_pcm_component_prepare(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 snd_soc_component *component;
        int i, ret;
 
@@ -764,7 +764,7 @@ int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
                                    struct snd_pcm_hw_params *params,
                                    struct snd_soc_component **last)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i, ret;
 
@@ -786,7 +786,7 @@ int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
 void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
                                   struct snd_soc_component *last)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i, ret;
 
@@ -805,7 +805,7 @@ void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
 int snd_soc_pcm_component_trigger(struct snd_pcm_substream *substream,
                                  int cmd)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_component *component;
        int i, ret;
 
index 98f0c98b06bbd78dbe56e39d80d8ba4be5e6e24b..693893420bf07c0022a3882ce02963ce243996a7 100644 (file)
@@ -316,7 +316,7 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai,
                          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);
        int ret = 0;
 
        /* perform any topology hw_params fixups before DAI  */
@@ -516,7 +516,7 @@ int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd)
 
 int snd_soc_pcm_dai_prepare(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 snd_soc_dai *dai;
        int i, ret;
 
@@ -535,7 +535,7 @@ int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream)
 int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
                            int cmd)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_dai *dai;
        int i, ret;
 
@@ -554,7 +554,7 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream,
 int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream,
                                    int cmd)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_dai *dai;
        int i, ret;
 
index e51aa2efc65cd9813910fbd6b25b53bb15228d78..5076299abf379a5c6fd96d7af1699b4847c716fc 100644 (file)
@@ -2673,7 +2673,7 @@ int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream,
                            struct snd_pcm_hw_params *params,
                            struct snd_soc_dai *dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        int ret;
 
        mutex_lock_nested(&rtd->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
@@ -3795,7 +3795,7 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
 {
        struct snd_soc_dapm_path *path;
        struct snd_soc_dai *source, *sink;
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_pcm_hw_params *params = NULL;
        const struct snd_soc_pcm_stream *config = NULL;
        struct snd_pcm_runtime *runtime = NULL;
@@ -4117,7 +4117,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card,
                     struct snd_pcm_substream *substream,
                     char *id)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_dapm_widget template;
        struct snd_soc_dapm_widget *w;
        const char **w_param_text;
index 61844403f1817fd2bdc7c781f0d1c545e5f16f97..d17b4bf1dbe38841c2953e33ec45aa7b880bfcfa 100644 (file)
@@ -46,7 +46,7 @@ static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm,
 int snd_dmaengine_pcm_prepare_slave_config(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 snd_dmaengine_dai_dma_data *dma_data;
        int ret;
 
@@ -105,7 +105,7 @@ static int
 dmaengine_pcm_set_runtime_hwparams(struct snd_soc_component *component,
                                   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 dmaengine_pcm *pcm = soc_component_to_pcm(component);
        struct device *dma_dev = dmaengine_dma_dev(pcm, substream);
        struct dma_chan *chan = pcm->chan[substream->stream];
index 1c3bf2118718e89baa5bf0ecc96303be1d0a2379..cec70b19863e21bd73f0455ba21de5a64d635e5d 100644 (file)
@@ -59,7 +59,7 @@ int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 
 int snd_soc_link_startup(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);
        int ret = 0;
 
        if (rtd->dai_link->ops &&
@@ -71,7 +71,7 @@ int snd_soc_link_startup(struct snd_pcm_substream *substream)
 
 void snd_soc_link_shutdown(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);
 
        if (rtd->dai_link->ops &&
            rtd->dai_link->ops->shutdown)
@@ -80,7 +80,7 @@ void snd_soc_link_shutdown(struct snd_pcm_substream *substream)
 
 int snd_soc_link_prepare(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);
        int ret = 0;
 
        if (rtd->dai_link->ops &&
@@ -93,7 +93,7 @@ int snd_soc_link_prepare(struct snd_pcm_substream *substream)
 int snd_soc_link_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);
        int ret = 0;
 
        if (rtd->dai_link->ops &&
@@ -105,7 +105,7 @@ int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
 
 void snd_soc_link_hw_free(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);
 
        if (rtd->dai_link->ops &&
            rtd->dai_link->ops->hw_free)
@@ -114,7 +114,7 @@ void snd_soc_link_hw_free(struct snd_pcm_substream *substream)
 
 int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        int ret = 0;
 
        if (rtd->dai_link->ops &&
index f2c7c85ad40c13b565497ddd87eb33b5a1033276..10f703986be3289e92c2395fde8946230df73a61 100644 (file)
@@ -304,7 +304,7 @@ int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
 static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
                                        struct snd_soc_dai *soc_dai)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        int ret;
 
        if (soc_dai->rate && (soc_dai->driver->symmetric_rates ||
@@ -361,7 +361,7 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
 static int soc_pcm_params_symmetry(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 *dai;
        struct snd_soc_dai *cpu_dai;
        unsigned int rate, channels, sample_bits, symmetry, i;
@@ -423,7 +423,7 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
 
 static bool soc_pcm_has_symmetry(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 snd_soc_dai_link *link = rtd->dai_link;
        struct snd_soc_dai *dai;
        unsigned int symmetry, i;
@@ -443,7 +443,7 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
 
 static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        int ret;
 
        if (!bits)
@@ -457,7 +457,7 @@ static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
 
 static void soc_pcm_apply_msb(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 snd_soc_dai *cpu_dai;
        struct snd_soc_dai *codec_dai;
        struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
@@ -592,7 +592,7 @@ EXPORT_SYMBOL_GPL(snd_soc_runtime_calc_hw);
 static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_hardware *hw = &substream->runtime->hw;
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        u64 formats = hw->formats;
 
        /*
@@ -608,7 +608,7 @@ static void soc_pcm_init_runtime_hw(struct snd_pcm_substream *substream)
 
 static int soc_pcm_components_open(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 snd_soc_component *last = NULL;
        struct snd_soc_component *component;
        int i, ret = 0;
@@ -650,7 +650,7 @@ static int soc_pcm_components_open(struct snd_pcm_substream *substream)
 
 static int soc_pcm_components_close(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 snd_soc_component *component;
        int i, r, ret = 0;
 
@@ -672,7 +672,7 @@ static int soc_pcm_components_close(struct snd_pcm_substream *substream)
  */
 static int soc_pcm_close(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 snd_soc_component *component;
        struct snd_soc_dai *dai;
        int i;
@@ -711,7 +711,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
  */
 static int soc_pcm_open(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 snd_pcm_runtime *runtime = substream->runtime;
        struct snd_soc_component *component;
        struct snd_soc_dai *dai;
@@ -850,7 +850,7 @@ static void codec2codec_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
  */
 static int soc_pcm_prepare(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 snd_soc_dai *dai;
        int i, ret = 0;
 
@@ -907,7 +907,7 @@ static void soc_pcm_codec_params_fixup(struct snd_pcm_hw_params *params,
 static int soc_pcm_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_component *component;
        struct snd_soc_dai *cpu_dai;
        struct snd_soc_dai *codec_dai;
@@ -1035,7 +1035,7 @@ codec_err:
  */
 static int soc_pcm_hw_free(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 snd_soc_dai *dai;
        int i;
 
@@ -1116,7 +1116,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
  */
 static snd_pcm_uframes_t soc_pcm_pointer(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 snd_soc_dai *cpu_dai;
        struct snd_soc_dai *codec_dai;
        struct snd_pcm_runtime *runtime = substream->runtime;
@@ -1594,7 +1594,7 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
 static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
                                      u64 *formats)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        struct snd_soc_dpcm *dpcm;
        struct snd_soc_dai *dai;
        int stream = substream->stream;
@@ -1631,7 +1631,7 @@ static void dpcm_runtime_merge_chan(struct snd_pcm_substream *substream,
                                    unsigned int *channels_min,
                                    unsigned int *channels_max)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        struct snd_soc_dpcm *dpcm;
        int stream = substream->stream;
 
@@ -1686,7 +1686,7 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
                                    unsigned int *rate_min,
                                    unsigned int *rate_max)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        struct snd_soc_dpcm *dpcm;
        int stream = substream->stream;
 
@@ -1724,7 +1724,7 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
        struct snd_soc_dai *cpu_dai;
        int i;
 
@@ -1775,7 +1775,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
                               int stream)
 {
        struct snd_soc_dpcm *dpcm;
-       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);
        struct snd_soc_dai *fe_cpu_dai;
        int err;
        int i;
@@ -1806,7 +1806,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
                if (!be_substream)
                        continue;
 
-               rtd = be_substream->private_data;
+               rtd = asoc_substream_to_rtd(be_substream);
                if (rtd->dai_link->be_hw_params_fixup)
                        continue;
 
@@ -1828,7 +1828,7 @@ static int dpcm_apply_symmetry(struct snd_pcm_substream *fe_substream,
 
 static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
 {
-       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);
        struct snd_pcm_runtime *runtime = fe_substream->runtime;
        int stream = fe_substream->stream, ret = 0;
 
@@ -1909,7 +1909,7 @@ int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
 
 static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int stream = substream->stream;
 
        dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE);
@@ -1975,7 +1975,7 @@ int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
 
 static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int err, stream = substream->stream;
 
        mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -2080,7 +2080,7 @@ unwind:
 static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
                                 struct snd_pcm_hw_params *params)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int ret, stream = substream->stream;
 
        mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -2226,7 +2226,7 @@ EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger);
 static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream,
                                  int cmd, bool fe_first)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int ret;
 
        /* call trigger on the frontend before the backend. */
@@ -2257,7 +2257,7 @@ static int dpcm_dai_trigger_fe_be(struct snd_pcm_substream *substream,
 
 static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int stream = substream->stream;
        int ret = 0;
        enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
@@ -2342,7 +2342,7 @@ out:
 
 static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int stream = substream->stream;
 
        /* if FE's runtime_update is already set, we're in race;
@@ -2395,7 +2395,7 @@ int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
 
 static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *fe = substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(substream);
        int stream = substream->stream, ret = 0;
 
        mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -2662,7 +2662,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dpcm_runtime_update);
 
 static void dpcm_fe_dai_cleanup(struct snd_pcm_substream *fe_substream)
 {
-       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);
        struct snd_soc_dpcm *dpcm;
        int stream = fe_substream->stream;
 
@@ -2677,7 +2677,7 @@ static void dpcm_fe_dai_cleanup(struct snd_pcm_substream *fe_substream)
 
 static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
 {
-       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);
        int ret;
 
        mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
@@ -2691,7 +2691,7 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
 
 static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
 {
-       struct snd_soc_pcm_runtime *fe = fe_substream->private_data;
+       struct snd_soc_pcm_runtime *fe = asoc_substream_to_rtd(fe_substream);
        struct snd_soc_dapm_widget_list *list;
        int ret;
        int stream = fe_substream->stream;
index 364b2483bdee874f20071b97b4409047221b5712..f27f94ca064bca45c28e3077d630e3e9f6558d63 100644 (file)
@@ -66,7 +66,7 @@ static const struct snd_pcm_hardware dummy_dma_hardware = {
 static int dummy_dma_open(struct snd_soc_component *component,
                          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);
 
        /* BE's dont need dummy params */
        if (!rtd->dai_link->no_pcm)