All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: core - Make platform probe more like codec probe.
@ 2011-07-01 15:54 Liam Girdwood
  2011-07-02 18:50 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Liam Girdwood @ 2011-07-01 15:54 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

In preparation for ASoC dynamic PCM support (AKA ASoC DSP)

Platform will also support DAPM so separate out the probe function
to simplify the code (just like the codec probe).

Signed-off-by: Liam Girdwood <lrg@ti.com>
---
 sound/soc/soc-core.c |   51 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 15 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 32bc503..d49f0ed 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -986,6 +986,39 @@ err_probe:
 	return ret;
 }
 
+static int soc_probe_platform(struct snd_soc_card *card,
+			   struct snd_soc_platform *platform)
+{
+	int ret = 0;
+	const struct snd_soc_platform_driver *driver = platform->driver;
+
+	platform->card = card;
+
+	if (!try_module_get(platform->dev->driver->owner))
+		return -ENODEV;
+
+	if (driver->probe) {
+		ret = driver->probe(platform);
+		if (ret < 0) {
+			dev_err(platform->dev,
+				"asoc: failed to probe platform %s: %d\n",
+				platform->name, ret);
+			goto err_probe;
+		}
+	}
+
+	/* mark platform as probed and add to card platform list */
+	platform->probed = 1;
+	list_add(&platform->card_list, &card->platform_dev_list);
+
+	return 0;
+
+err_probe:
+	module_put(platform->dev->driver->owner);
+
+	return ret;
+}
+
 static void rtd_release(struct device *dev) {}
 
 static int soc_post_component_init(struct snd_soc_card *card,
@@ -1109,21 +1142,9 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
 	/* probe the platform */
 	if (!platform->probed &&
 			platform->driver->probe_order == order) {
-		if (!try_module_get(platform->dev->driver->owner))
-			return -ENODEV;
-
-		if (platform->driver->probe) {
-			ret = platform->driver->probe(platform);
-			if (ret < 0) {
-				printk(KERN_ERR "asoc: failed to probe platform %s\n",
-						platform->name);
-				module_put(platform->dev->driver->owner);
-				return ret;
-			}
-		}
-		/* mark platform as probed and add to card platform list */
-		platform->probed = 1;
-		list_add(&platform->card_list, &card->platform_dev_list);
+		ret = soc_probe_platform(card, platform);
+		if (ret < 0)
+			return ret;
 	}
 
 	/* probe the CODEC DAI */
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: core - Make platform probe more like codec probe.
  2011-07-01 15:54 [PATCH] ASoC: core - Make platform probe more like codec probe Liam Girdwood
@ 2011-07-02 18:50 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-07-02 18:50 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel

On Fri, Jul 01, 2011 at 04:54:08PM +0100, Liam Girdwood wrote:
> In preparation for ASoC dynamic PCM support (AKA ASoC DSP)
> 
> Platform will also support DAPM so separate out the probe function
> to simplify the code (just like the codec probe).

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-02 18:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-01 15:54 [PATCH] ASoC: core - Make platform probe more like codec probe Liam Girdwood
2011-07-02 18:50 ` Mark Brown

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.