[alsa-devel] [PATCH 061/127] ASoC: use component probe/remove on cx20442

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

diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index 2c12471..191d109 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -356,8 +356,9 @@ static int cx20442_set_bias_level(struct snd_soc_codec *codec,
 	return err;
 }
 
-static int cx20442_codec_probe(struct snd_soc_codec *codec)
+static int cx20442_codec_probe(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct cx20442_priv *cx20442;
 
 	cx20442 = kzalloc(sizeof(struct cx20442_priv), GFP_KERNEL);
@@ -377,8 +378,9 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
 }
 
 /* power down chip */
-static int cx20442_codec_remove(struct snd_soc_codec *codec)
+static void cx20442_codec_remove(struct snd_soc_component *component)
 {
+	struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 	struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
 
 	if (cx20442->control_data) {
@@ -393,14 +395,11 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
 
 	snd_soc_codec_set_drvdata(codec, NULL);
 	kfree(cx20442);
-	return 0;
 }
 
 static const u8 cx20442_reg;
 
 static struct snd_soc_codec_driver cx20442_codec_dev = {
-	.probe = 	cx20442_codec_probe,
-	.remove = 	cx20442_codec_remove,
 	.set_bias_level = cx20442_set_bias_level,
 	.reg_cache_default = &cx20442_reg,
 	.reg_cache_size = 1,
@@ -408,6 +407,8 @@ static struct snd_soc_codec_driver cx20442_codec_dev = {
 	.read = cx20442_read_reg_cache,
 	.write = cx20442_write,
 	.component_driver = {
+		.probe			= cx20442_codec_probe,
+		.remove			= cx20442_codec_remove,
 		.dapm_widgets		= cx20442_dapm_widgets,
 		.num_dapm_widgets	= ARRAY_SIZE(cx20442_dapm_widgets),
 		.dapm_routes		= cx20442_audio_map,
-- 
1.9.1



More information about the Alsa-devel mailing list