[6/9] ASoC: soc-core: merge soc_remove_component() and soc_cleanup_component()
diff mbox series

Message ID 87o8xphkwt.wl-kuninori.morimoto.gx@renesas.com
State Accepted
Commit c6619b729814c855fc7bfa5a6936f5ea94d60dfd
Headers show
Series
  • ASoC: soc-core: cleanup step5
Related show

Commit Message

Kuninori Morimoto Nov. 6, 2019, 1:07 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

having both soc_remove_component() and soc_cleanup_component() is
very confusable. Let's merge these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Mark Brown Nov. 12, 2019, 6:46 p.m. UTC | #1
On Wed, Nov 06, 2019 at 10:07:46AM +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> having both soc_remove_component() and soc_cleanup_component() is
> very confusable. Let's merge these.

This doesn't apply against current code, please check and resend.
Kuninori Morimoto Nov. 13, 2019, 12:50 a.m. UTC | #2
Hi Mark

Thank you for applying my patches

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > having both soc_remove_component() and soc_cleanup_component() is
> > very confusable. Let's merge these.
> 
> This doesn't apply against current code, please check and resend.

I could find this patch as
c6619b729814c855fc7bfa5a6936f5ea94d60dfd
("ASoC: soc-core: merge soc_remove_component() and soc_cleanup_component()")

Thank you for your help !!
Best regards
---
Kuninori Morimoto

Patch
diff mbox series

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 28f94a2..763a63d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1191,8 +1191,16 @@  static void soc_set_name_prefix(struct snd_soc_card *card,
 	soc_set_of_name_prefix(component);
 }
 
-static void soc_cleanup_component(struct snd_soc_component *component)
+static void soc_remove_component(struct snd_soc_component *component,
+				 int probed)
 {
+
+	if (!component->card)
+		return;
+
+	if (probed)
+		snd_soc_component_remove(component);
+
 	/* For framework level robustness */
 	snd_soc_component_set_jack(component, NULL, NULL);
 
@@ -1203,22 +1211,13 @@  static void soc_cleanup_component(struct snd_soc_component *component)
 	snd_soc_component_module_put_when_remove(component);
 }
 
-static void soc_remove_component(struct snd_soc_component *component)
-{
-	if (!component->card)
-		return;
-
-	snd_soc_component_remove(component);
-
-	soc_cleanup_component(component);
-}
-
 static int soc_probe_component(struct snd_soc_card *card,
 			       struct snd_soc_component *component)
 {
 	struct snd_soc_dapm_context *dapm =
 		snd_soc_component_get_dapm(component);
 	struct snd_soc_dai *dai;
+	int probed = 0;
 	int ret;
 
 	if (!strcmp(component->name, "snd-soc-dummy"))
@@ -1274,6 +1273,7 @@  static int soc_probe_component(struct snd_soc_card *card,
 	     dapm->bias_level != SND_SOC_BIAS_OFF,
 	     "codec %s can not start from non-off bias with idle_bias_off==1\n",
 	     component->name);
+	probed = 1;
 
 	/* machine specific init */
 	if (component->init) {
@@ -1302,7 +1302,7 @@  static int soc_probe_component(struct snd_soc_card *card,
 
 err_probe:
 	if (ret < 0)
-		soc_cleanup_component(component);
+		soc_remove_component(component, probed);
 
 	return ret;
 }
@@ -1404,7 +1404,7 @@  static void soc_remove_link_components(struct snd_soc_card *card)
 				if (component->driver->remove_order != order)
 					continue;
 
-				soc_remove_component(component);
+				soc_remove_component(component, 1);
 			}
 		}
 	}
@@ -1598,7 +1598,7 @@  static void soc_remove_aux_devices(struct snd_soc_card *card)
 	for_each_comp_order(order) {
 		for_each_card_auxs_safe(card, comp, _comp) {
 			if (comp->driver->remove_order == order)
-				soc_remove_component(comp);
+				soc_remove_component(comp, 1);
 		}
 	}
 }