[alsa-devel] [PATCH 103/127] ASoC: use component probe/remove on rt5670

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Aug 9 07:36:51 CEST 2016


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

codec driver and component driver has duplicated .probe/.remove
functions, and codec side is just relayed it. This was quick-hack,
but no longer needed.
This patch uses component .probe/.remove

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/codecs/rt5670.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index 49caf13..850f4ea 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -2651,8 +2651,9 @@ static int rt5670_set_bias_level(struct snd_soc_codec *codec,
 	return 0;
 }
 
-static int rt5670_probe(struct snd_soc_codec *codec)
+static int rt5670_probe(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
 	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
 
@@ -2684,13 +2685,13 @@ static int rt5670_probe(struct snd_soc_codec *codec)
 	return 0;
 }
 
-static int rt5670_remove(struct snd_soc_codec *codec)
+static void rt5670_remove(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct rt5670_priv *rt5670 = snd_soc_codec_get_drvdata(codec);
 
 	regmap_write(rt5670->regmap, RT5670_RESET, 0);
 	snd_soc_jack_free_gpios(rt5670->jack, 1, &rt5670->hp_gpio);
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -2771,13 +2772,13 @@ static struct snd_soc_dai_driver rt5670_dai[] = {
 };
 
 static struct snd_soc_codec_driver soc_codec_dev_rt5670 = {
-	.probe = rt5670_probe,
-	.remove = rt5670_remove,
 	.suspend = rt5670_suspend,
 	.resume = rt5670_resume,
 	.set_bias_level = rt5670_set_bias_level,
 	.idle_bias_off = true,
 	.component_driver = {
+		.probe			= rt5670_probe,
+		.remove			= rt5670_remove,
 		.controls		= rt5670_snd_controls,
 		.num_controls		= ARRAY_SIZE(rt5670_snd_controls),
 		.dapm_widgets		= rt5670_dapm_widgets,
-- 
1.9.1



More information about the Alsa-devel mailing list