[alsa-devel] [PATCH 5/5] ASoC: soc-devres: use expanded unregister on devm register component

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Aug 2 06:27:03 CEST 2017


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

Now, we have snd_soc_unregister_component_exp() which can check
registered device and driver.
Let's use it on devm_component_release()

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

diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
index a57921e..9194696 100644
--- a/sound/soc/soc-devres.c
+++ b/sound/soc/soc-devres.c
@@ -16,7 +16,7 @@
 
 static void devm_component_release(struct device *dev, void *res)
 {
-	snd_soc_unregister_component(*(struct device **)res);
+	snd_soc_unregister_component_exp(dev, *(const char **)res);
 }
 
 /**
@@ -33,7 +33,7 @@ int devm_snd_soc_register_component(struct device *dev,
 			 const struct snd_soc_component_driver *cmpnt_drv,
 			 struct snd_soc_dai_driver *dai_drv, int num_dai)
 {
-	struct device **ptr;
+	const char **ptr;
 	int ret;
 
 	ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL);
@@ -42,7 +42,7 @@ int devm_snd_soc_register_component(struct device *dev,
 
 	ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai);
 	if (ret == 0) {
-		*ptr = dev;
+		*ptr = cmpnt_drv->name;
 		devres_add(dev, ptr);
 	} else {
 		devres_free(ptr);
-- 
1.9.1



More information about the Alsa-devel mailing list