ASoC: mediatek: remove snd_pcm_ops
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 2 Oct 2019 05:34:05 +0000 (14:34 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 8 Oct 2019 12:48:07 +0000 (13:48 +0100)
snd_pcm_ops is no longer needed.
Let's use component driver callback.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k19n90du.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/common/mtk-afe-platform-driver.c
sound/soc/mediatek/common/mtk-afe-platform-driver.h
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c

index 3ce527ce30ce0610ee107a37a0543aa14dce7fb8..b6624d8d084bfc284f37774ad03de1d4f3e0124e 100644 (file)
@@ -77,11 +77,10 @@ int mtk_afe_add_sub_dai_control(struct snd_soc_component *component)
 }
 EXPORT_SYMBOL_GPL(mtk_afe_add_sub_dai_control);
 
-static snd_pcm_uframes_t mtk_afe_pcm_pointer
-                        (struct snd_pcm_substream *substream)
+snd_pcm_uframes_t mtk_afe_pcm_pointer(struct snd_soc_component *component,
+                                     struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
-       struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
        struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
        struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
        const struct mtk_base_memif_data *memif_data = memif->data;
@@ -111,18 +110,13 @@ static snd_pcm_uframes_t mtk_afe_pcm_pointer
 POINTER_RETURN_FRAMES:
        return bytes_to_frames(substream->runtime, pcm_ptr_bytes);
 }
+EXPORT_SYMBOL_GPL(mtk_afe_pcm_pointer);
 
-const struct snd_pcm_ops mtk_afe_pcm_ops = {
-       .ioctl = snd_pcm_lib_ioctl,
-       .pointer = mtk_afe_pcm_pointer,
-};
-EXPORT_SYMBOL_GPL(mtk_afe_pcm_ops);
-
-int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
+int mtk_afe_pcm_new(struct snd_soc_component *component,
+                   struct snd_soc_pcm_runtime *rtd)
 {
        size_t size;
        struct snd_pcm *pcm = rtd->pcm;
-       struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
        struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
 
        size = afe->mtk_afe_hardware->buffer_bytes_max;
@@ -132,17 +126,19 @@ int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
 }
 EXPORT_SYMBOL_GPL(mtk_afe_pcm_new);
 
-void mtk_afe_pcm_free(struct snd_pcm *pcm)
+void mtk_afe_pcm_free(struct snd_soc_component *component,
+                     struct snd_pcm *pcm)
 {
        snd_pcm_lib_preallocate_free_for_all(pcm);
 }
 EXPORT_SYMBOL_GPL(mtk_afe_pcm_free);
 
 const struct snd_soc_component_driver mtk_afe_pcm_platform = {
-       .name = AFE_PCM_NAME,
-       .ops = &mtk_afe_pcm_ops,
-       .pcm_new = mtk_afe_pcm_new,
-       .pcm_free = mtk_afe_pcm_free,
+       .name           = AFE_PCM_NAME,
+       .ioctl          = snd_soc_pcm_lib_ioctl,
+       .pointer        = mtk_afe_pcm_pointer,
+       .pcm_construct  = mtk_afe_pcm_new,
+       .pcm_destruct   = mtk_afe_pcm_free,
 };
 EXPORT_SYMBOL_GPL(mtk_afe_pcm_platform);
 
index 88df6797732fb8c1b82d55cd0fa17058f1c92602..e550d11568c36c26397e7d39f7ef9071166178b1 100644 (file)
@@ -10,7 +10,6 @@
 #define _MTK_AFE_PLATFORM_DRIVER_H_
 
 #define AFE_PCM_NAME "mtk-afe-pcm"
-extern const struct snd_pcm_ops mtk_afe_pcm_ops;
 extern const struct snd_soc_component_driver mtk_afe_pcm_platform;
 
 struct mtk_base_afe;
@@ -18,9 +17,12 @@ struct snd_pcm;
 struct snd_soc_component;
 struct snd_soc_pcm_runtime;
 
-
-int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd);
-void mtk_afe_pcm_free(struct snd_pcm *pcm);
+snd_pcm_uframes_t mtk_afe_pcm_pointer(struct snd_soc_component *component,
+                                     struct snd_pcm_substream *substream);
+int mtk_afe_pcm_new(struct snd_soc_component *component,
+                   struct snd_soc_pcm_runtime *rtd);
+void mtk_afe_pcm_free(struct snd_soc_component *component,
+                     struct snd_pcm *pcm);
 
 int mtk_afe_combine_sub_dai(struct mtk_base_afe *afe);
 int mtk_afe_add_sub_dai_control(struct snd_soc_component *component);
index e52c032d53aa0789f61f0edcc4d612575cf800dd..033c07fb599c76cdb1c899be71c6c45b866ef31d 100644 (file)
@@ -710,11 +710,12 @@ static int mt6797_afe_component_probe(struct snd_soc_component *component)
 }
 
 static const struct snd_soc_component_driver mt6797_afe_component = {
-       .name = AFE_PCM_NAME,
-       .ops = &mtk_afe_pcm_ops,
-       .pcm_new = mtk_afe_pcm_new,
-       .pcm_free = mtk_afe_pcm_free,
-       .probe = mt6797_afe_component_probe,
+       .name           = AFE_PCM_NAME,
+       .probe          = mt6797_afe_component_probe,
+       .ioctl          = snd_soc_pcm_lib_ioctl,
+       .pointer        = mtk_afe_pcm_pointer,
+       .pcm_construct  = mtk_afe_pcm_new,
+       .pcm_destruct   = mtk_afe_pcm_free,
 };
 
 static int mt6797_dai_memif_register(struct mtk_base_afe *afe)
index 721632386a501432822c9056f4be89d7187a8562..76af09d8f1af9b381ff3a05a63297c50cb698884 100644 (file)
@@ -1048,11 +1048,12 @@ static int mt8183_afe_component_probe(struct snd_soc_component *component)
 }
 
 static const struct snd_soc_component_driver mt8183_afe_component = {
-       .name = AFE_PCM_NAME,
-       .ops = &mtk_afe_pcm_ops,
-       .pcm_new = mtk_afe_pcm_new,
-       .pcm_free = mtk_afe_pcm_free,
-       .probe = mt8183_afe_component_probe,
+       .name           = AFE_PCM_NAME,
+       .probe          = mt8183_afe_component_probe,
+       .ioctl          = snd_soc_pcm_lib_ioctl,
+       .pointer        = mtk_afe_pcm_pointer,
+       .pcm_construct  = mtk_afe_pcm_new,
+       .pcm_destruct   = mtk_afe_pcm_free,
 };
 
 static int mt8183_dai_memif_register(struct mtk_base_afe *afe)