From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@kernel.org>, Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 07/13] ASoC: Move component->probed check into soc_{remove, probe}_component()
Date: Tue, 19 Aug 2014 15:51:24 +0200 [thread overview]
Message-ID: <1408456290-13945-8-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1408456290-13945-1-git-send-email-lars@metafoo.de>
Having the check in a centralized place makes the code a bit cleaner and
shorter.
Note: There is a slight semantic change in this patch. soc_probe_aux_dev() will
no longer return -EBUSY if the AUX dev has already been probed before. This is
fine though since it will simply do nothing in that case and return success.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
sound/soc/soc-core.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b84bf05..19b3d2c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1004,6 +1004,9 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
static void soc_remove_component(struct snd_soc_component *component)
{
+ if (!component->probed)
+ return;
+
/* This is a HACK and will be removed soon */
if (component->codec)
list_del(&component->codec->card_list);
@@ -1079,22 +1082,19 @@ static void soc_remove_link_components(struct snd_soc_card *card, int num,
int i;
/* remove the platform */
- if (platform && platform->component.probed &&
- platform->component.driver->remove_order == order)
+ if (platform && platform->component.driver->remove_order == order)
soc_remove_component(&platform->component);
/* remove the CODEC-side CODEC */
for (i = 0; i < rtd->num_codecs; i++) {
component = rtd->codec_dais[i]->component;
- if (component->probed &&
- component->driver->remove_order == order)
+ if (component->driver->remove_order == order)
soc_remove_component(component);
}
/* remove any CPU-side CODEC */
if (cpu_dai) {
- if (cpu_dai->component->probed &&
- cpu_dai->component->driver->remove_order == order)
+ if (cpu_dai->component->driver->remove_order == order)
soc_remove_component(cpu_dai->component);
}
}
@@ -1145,6 +1145,9 @@ static int soc_probe_component(struct snd_soc_card *card,
struct snd_soc_dai *dai;
int ret;
+ if (component->probed)
+ return 0;
+
component->card = card;
dapm->card = card;
soc_set_name_prefix(card, component);
@@ -1306,8 +1309,7 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num,
/* probe the CPU-side component, if it is a CODEC */
component = rtd->cpu_dai->component;
- if (!component->probed &&
- component->driver->probe_order == order) {
+ if (component->driver->probe_order == order) {
ret = soc_probe_component(card, component);
if (ret < 0)
return ret;
@@ -1316,8 +1318,7 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num,
/* probe the CODEC-side components */
for (i = 0; i < rtd->num_codecs; i++) {
component = rtd->codec_dais[i]->component;
- if (!component->probed &&
- component->driver->probe_order == order) {
+ if (component->driver->probe_order == order) {
ret = soc_probe_component(card, component);
if (ret < 0)
return ret;
@@ -1325,8 +1326,7 @@ static int soc_probe_link_components(struct snd_soc_card *card, int num,
}
/* probe the platform */
- if (!platform->component.probed &&
- platform->component.driver->probe_order == order) {
+ if (platform->component.driver->probe_order == order) {
ret = soc_probe_component(card, &platform->component);
if (ret < 0)
return ret;
@@ -1621,11 +1621,6 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
int ret;
- if (rtd->component->probed) {
- dev_err(rtd->dev, "ASoC: codec already probed\n");
- return -EBUSY;
- }
-
ret = soc_probe_component(card, rtd->component);
if (ret < 0)
return ret;
--
1.8.0
next prev parent reply other threads:[~2014-08-19 13:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-19 13:51 [PATCH 00/13] ASoC: Componentization: Unified probe/remove path Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 01/13] ASoC: Move debugfs registration to the component level Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 02/13] ASoC: Consolidate platform and CODEC probe/remove Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 03/13] ASoC: Make rtd->codec optional Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 04/13] ASoC: Add component level probe/remove support Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 05/13] ASoC: Move AUX dev support to the component level Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 06/13] ASoC: Pass component instead of DAPM context to AUX dev init callback Lars-Peter Clausen
2014-08-19 13:51 ` Lars-Peter Clausen [this message]
2014-08-19 13:51 ` [PATCH 08/13] ASoC: Cleanup DAI module reference counting Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 09/13] ASoC: Consolidate CPU and CODEC DAI removal Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 10/13] ASoC: Consolidate CPU and CODEC DAI lookup Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 11/13] ASoC: Automatically initialize regmap for all components Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 12/13] ASoC: Remove support for legacy snd_soc_platform IO Lars-Peter Clausen
2014-08-19 13:51 ` [PATCH 13/13] ASoC: Replace list_empty(&card->codec_dev_list) with !card->instantiated Lars-Peter Clausen
2014-08-19 16:01 ` [PATCH 00/13] ASoC: Componentization: Unified probe/remove path Mark Brown
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=1408456290-13945-8-git-send-email-lars@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).