[alsa-devel] [PATCH 100/127] ASoC: use component probe/remove on stac9766

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Aug 9 07:35:34 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/stac9766.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 2c5941f..1750588 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -297,8 +297,9 @@ static struct snd_soc_dai_driver stac9766_dai[] = {
 }
 };
 
-static int stac9766_codec_probe(struct snd_soc_codec *codec)
+static int stac9766_codec_probe(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct snd_ac97 *ac97;
 
 	ac97 = snd_soc_new_ac97_codec(codec, STAC9766_VENDOR_ID,
@@ -311,16 +312,18 @@ static int stac9766_codec_probe(struct snd_soc_codec *codec)
 	return 0;
 }
 
-static int stac9766_codec_remove(struct snd_soc_codec *codec)
+static void stac9766_codec_remove(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec);
 
 	snd_soc_free_ac97_codec(ac97);
-	return 0;
 }
 
 static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
 	.component_driver = {
+		.probe			= stac9766_codec_probe,
+		.remove			= stac9766_codec_remove,
 		.controls		= stac9766_snd_ac97_controls,
 		.num_controls		= ARRAY_SIZE(stac9766_snd_ac97_controls),
 	},
@@ -328,8 +331,6 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
 	.read = stac9766_ac97_read,
 	.set_bias_level = stac9766_set_bias_level,
 	.suspend_bias_off = true,
-	.probe = stac9766_codec_probe,
-	.remove = stac9766_codec_remove,
 	.resume = stac9766_codec_resume,
 	.reg_cache_size = ARRAY_SIZE(stac9766_reg),
 	.reg_word_size = sizeof(u16),
-- 
1.9.1



More information about the Alsa-devel mailing list