OSDN Git Service

ASoC: stm: use asoc_substream_to_rtd()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 20 Jul 2020 01:18:01 +0000 (10:18 +0900)
committerMark Brown <broonie@kernel.org>
Thu, 23 Jul 2020 18:07:23 +0000 (19:07 +0100)
Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pn8r0yus.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/stm/stm32_adfsdm.c
sound/soc/stm/stm32_sai_sub.c

index 16ff029..c1433c2 100644 (file)
@@ -168,7 +168,7 @@ static void stm32_memcpy_32to16(void *dest, const void *src, size_t n)
 static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
 {
        struct stm32_adfsdm_priv *priv = private;
-       struct snd_soc_pcm_runtime *rtd = priv->substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(priv->substream);
        u8 *pcm_buff = priv->pcm_buff;
        u8 *src_buff = (u8 *)data;
        unsigned int old_pos = priv->pos;
@@ -213,7 +213,7 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)
 static int stm32_adfsdm_trigger(struct snd_soc_component *component,
                                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 stm32_adfsdm_priv *priv =
                snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
 
@@ -234,7 +234,7 @@ static int stm32_adfsdm_trigger(struct snd_soc_component *component,
 static int stm32_adfsdm_pcm_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);
        struct stm32_adfsdm_priv *priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
        int ret;
 
@@ -248,7 +248,7 @@ static int stm32_adfsdm_pcm_open(struct snd_soc_component *component,
 static int stm32_adfsdm_pcm_close(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 stm32_adfsdm_priv *priv =
                snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
 
@@ -261,7 +261,7 @@ static snd_pcm_uframes_t stm32_adfsdm_pcm_pointer(
                                            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 stm32_adfsdm_priv *priv =
                snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
 
@@ -272,7 +272,7 @@ static int stm32_adfsdm_pcm_hw_params(struct snd_soc_component *component,
                                      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 stm32_adfsdm_priv *priv =
                snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
 
index 41f01c3..3fb9513 100644 (file)
@@ -1237,7 +1237,7 @@ static int stm32_sai_pcm_process_spdif(struct snd_pcm_substream *substream,
                                       void *buf, unsigned long bytes)
 {
        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 = asoc_rtd_to_cpu(rtd, 0);
        struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev);
        int *ptr = (int *)(runtime->dma_area + hwoff +