All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [alsa-devel] [PATCH v2 14/22] ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component()
Date: 15 Oct 2019 13:00:46 +0900	[thread overview]
Message-ID: <87sgnu4q05.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87d0ey64n5.wl-kuninori.morimoto.gx@renesas.com>

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

snd_soc_unregister_component() is now finding component manually,
but we already have snd_soc_lookup_component() to find component;
Let's use existing function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

	- keep mutex_lock()

 sound/soc/soc-core.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 1bb98ac..d05d95c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2879,29 +2879,19 @@ EXPORT_SYMBOL_GPL(snd_soc_register_component);
  *
  * @dev: The device to unregister
  */
-static int __snd_soc_unregister_component(struct device *dev)
+void snd_soc_unregister_component(struct device *dev)
 {
 	struct snd_soc_component *component;
-	int found = 0;
 
 	mutex_lock(&client_mutex);
-	for_each_component(component) {
-		if (dev != component->dev)
-			continue;
+	while (1) {
+		component = snd_soc_lookup_component(dev, NULL);
+		if (!component)
+			break;
 
 		snd_soc_del_component_unlocked(component);
-		found = 1;
-		break;
 	}
 	mutex_unlock(&client_mutex);
-
-	return found;
-}
-
-void snd_soc_unregister_component(struct device *dev)
-{
-	while (__snd_soc_unregister_component(dev))
-		;
 }
 EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
 
-- 
2.7.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-10-15  4:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  3:59 [alsa-devel] [PATCH v2 00/22] ASoC: soc-core cleanup - step 4 Kuninori Morimoto
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 03/22] ASoC: soc-core: add for_each_rtd_components() and replace Kuninori Morimoto
2019-10-23 18:56   ` [alsa-devel] Applied "ASoC: soc-core: add for_each_rtd_components() and replace" to the asoc tree Mark Brown
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 01/22] ASoC: soc-pcm: fixup dpcm_prune_paths() loop continue Kuninori Morimoto
2019-10-22 18:15   ` [alsa-devel] Applied "ASoC: soc-pcm: fixup dpcm_prune_paths() loop continue" to the asoc tree Mark Brown
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 02/22] ASoC: soc-core: remove for_each_rtdcom_safe() Kuninori Morimoto
2019-10-22 18:15   ` [alsa-devel] Applied "ASoC: soc-core: remove for_each_rtdcom_safe()" to the asoc tree Mark Brown
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 07/22] ASoC: soc-core: tidyup soc_init_dai_link() Kuninori Morimoto
2019-10-24 11:48   ` Mark Brown
2019-10-25  0:55     ` Kuninori Morimoto
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 04/22] ASoC: soc-core: snd_soc_unbind_card() cleanup Kuninori Morimoto
2019-10-22 18:15   ` [alsa-devel] Applied "ASoC: soc-core: snd_soc_unbind_card() cleanup" to the asoc tree Mark Brown
2019-10-15  3:59 ` [alsa-devel] [PATCH v2 05/22] ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 09/22] ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 06/22] ASoC: soc-core: move soc_init_dai_link() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 10/22] ASoC: soc-core: add soc_unbind_dai_link() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 08/22] ASoC: soc-core: remove duplicated soc_is_dai_link_bound() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 11/22] ASoC: soc-core: move snd_soc_lookup_component() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 12/22] ASoC: soc-core: add snd_soc_del_component_unlocked() Kuninori Morimoto
2019-10-15  4:00 ` Kuninori Morimoto [this message]
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 15/22] ASoC: soc-core: move snd_soc_register_dai() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 18/22] ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 19/22] ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() " Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 20/22] ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 16/22] ASoC: soc-core: move snd_soc_unregister_dais() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 21/22] ASoC: soc-core: remove topology specific operation Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 17/22] ASoC: soc-core: add snd_soc_unregister_dai() Kuninori Morimoto
2019-10-15  4:00 ` [alsa-devel] [PATCH v2 22/22] ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY Kuninori Morimoto
2019-10-15  4:01 ` [alsa-devel] [PATCH v2 13/22] ASoC: soc-core: remove snd_soc_component_add/del() Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgnu4q05.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.