ASoC: fsl: Use snd_soc_substream_to_rtd() for accessing private_data
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 30 Apr 2024 14:02:15 +0000 (16:02 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 6 May 2024 14:59:51 +0000 (23:59 +0900)
Do not open-code snd_soc_substream_to_rtd().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240430-asoc-snd-substream-clean-v1-6-6f8a8902b479@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl-asoc-card.c
sound/soc/fsl/imx-card.c
sound/soc/fsl/imx-hdmi.c
sound/soc/fsl/imx-pcm-rpmsg.c

index f6d2564864c601164790cbe918bc518a886b08f2..5ddc0c2fe53ff4b45346c77b86acff57b30bf890 100644 (file)
@@ -242,7 +242,7 @@ fail:
 
 static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
        struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
        struct codec_priv *codec_priv = &priv->codec_priv;
        struct device *dev = rtd->card->dev;
index cb8723965f2f8964a1148093e122b4dee891eff6..0e18ccabe28c315f34f073bc7ec15e5eeefebbe2 100644 (file)
@@ -252,7 +252,7 @@ static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
                                           struct snd_pcm_hw_params *params,
                                           int slots, int slot_width)
 {
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
        struct imx_card_data *data = snd_soc_card_get_drvdata(rtd->card);
        const struct imx_card_plat_data *plat_data = data->plat_data;
        struct dai_link_data *link_data = &data->link_data[rtd->num];
@@ -289,7 +289,7 @@ static unsigned long akcodec_get_mclk_rate(struct snd_pcm_substream *substream,
 static int imx_aif_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 = snd_soc_substream_to_rtd(substream);
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
        struct snd_soc_card *card = rtd->card;
        struct imx_card_data *data = snd_soc_card_get_drvdata(card);
@@ -405,7 +405,7 @@ static int ak5558_hw_rule_rate(struct snd_pcm_hw_params *p, struct snd_pcm_hw_ru
 static int imx_aif_startup(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 = snd_soc_substream_to_rtd(substream);
        struct snd_soc_card *card = rtd->card;
        struct imx_card_data *data = snd_soc_card_get_drvdata(card);
        struct dai_link_data *link_data = &data->link_data[rtd->num];
index e454085c6e5cf8e8ef57685ca0de5338ee1fd72d..fe47b439a8183d47f83325e18c8854118797fac1 100644 (file)
@@ -32,7 +32,7 @@ struct imx_hdmi_data {
 static int imx_hdmi_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 = snd_soc_substream_to_rtd(substream);
        struct imx_hdmi_data *data = snd_soc_card_get_drvdata(rtd->card);
        bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
index b84d1dfddba2f150e307ada95001290188ee9e5a..ba491cbb993003dce9b7bda190712a46f8ec6019 100644 (file)
@@ -316,7 +316,7 @@ static int imx_rpmsg_pcm_prepare(struct snd_soc_component *component,
                                 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 = snd_soc_substream_to_rtd(substream);
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
        struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
 
@@ -461,7 +461,7 @@ static int imx_rpmsg_pcm_trigger(struct snd_soc_component *component,
                                 struct snd_pcm_substream *substream, int cmd)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
-       struct snd_soc_pcm_runtime *rtd = substream->private_data;
+       struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
        struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
        int ret = 0;
@@ -515,7 +515,7 @@ static int imx_rpmsg_pcm_ack(struct snd_soc_component *component,
                             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 = snd_soc_substream_to_rtd(substream);
        struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
        struct fsl_rpmsg *rpmsg = dev_get_drvdata(cpu_dai->dev);
        struct rpmsg_info *info = dev_get_drvdata(component->dev);