alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices
  2011-01-27 14:24 ` [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices Jarkko Nikula
@ 2011-01-27 14:23   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-01-27 14:23 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: Vinod Koul, alsa-devel, Harsha Priya, Liam Girdwood

On Thu, Jan 27, 2011 at 04:24:21PM +0200, Jarkko Nikula wrote:
> Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers"
> moved codec driver refcount increments from soc_bind_dai_link into
> soc_probe_codec.
> 
> However, the commit didn't remove try_module_get from soc_probe_aux_dev so
> the auxiliary device reference counts are incremented twice as the
> soc_probe_codec is called from soc_probe_aux_dev too.

This is already applied for 2.6.38.

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

* [PATCH 0/2] ASoC: Refcount fixes
@ 2011-01-27 14:24 Jarkko Nikula
  2011-01-27 14:24 ` [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices Jarkko Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jarkko Nikula @ 2011-01-27 14:24 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

Hi

Nothing new, just yesterday's refcount fix for-2.6.38 and another minor
for-2.6.39 rebased on top of for-2.6.39 and sent together.

-- 
Jarkko

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

* [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices
  2011-01-27 14:24 [PATCH 0/2] ASoC: Refcount fixes Jarkko Nikula
@ 2011-01-27 14:24 ` Jarkko Nikula
  2011-01-27 14:23   ` Mark Brown
  2011-01-27 14:24 ` [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing Jarkko Nikula
  2011-01-27 20:42 ` [PATCH 0/2] ASoC: Refcount fixes Liam Girdwood
  2 siblings, 1 reply; 6+ messages in thread
From: Jarkko Nikula @ 2011-01-27 14:24 UTC (permalink / raw)
  To: alsa-devel; +Cc: Vinod Koul, Mark Brown, Harsha Priya, Liam Girdwood

Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers"
moved codec driver refcount increments from soc_bind_dai_link into
soc_probe_codec.

However, the commit didn't remove try_module_get from soc_probe_aux_dev so
the auxiliary device reference counts are incremented twice as the
soc_probe_codec is called from soc_probe_aux_dev too.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Harsha Priya <priya.harsha@intel.com>
---
 sound/soc/soc-core.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 8af47f7..e9f81c5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1670,9 +1670,6 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
 	goto out;
 
 found:
-	if (!try_module_get(codec->dev->driver->owner))
-		return -ENODEV;
-
 	ret = soc_probe_codec(card, codec);
 	if (ret < 0)
 		return ret;
-- 
1.7.2.3

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

* [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing
  2011-01-27 14:24 [PATCH 0/2] ASoC: Refcount fixes Jarkko Nikula
  2011-01-27 14:24 ` [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices Jarkko Nikula
@ 2011-01-27 14:24 ` Jarkko Nikula
  2011-01-28 12:58   ` Mark Brown
  2011-01-27 20:42 ` [PATCH 0/2] ASoC: Refcount fixes Liam Girdwood
  2 siblings, 1 reply; 6+ messages in thread
From: Jarkko Nikula @ 2011-01-27 14:24 UTC (permalink / raw)
  To: alsa-devel; +Cc: Vinod Koul, Mark Brown, Harsha Priya, Liam Girdwood

Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers"
moved codec and platform driver refcount increments from soc_bind_dai_link
to more appropriate places.

Adjust a little them so that refcounts are incremented before executing the
driver probe functions.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Harsha Priya <priya.harsha@intel.com>
---
I don't know any regression with this so probably 2.6.39 material.
---
 sound/soc/soc-core.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e9f81c5..9dfbb8f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1412,26 +1412,31 @@ static int soc_probe_codec(struct snd_soc_card *card,
 	codec->dapm.card = card;
 	soc_set_name_prefix(card, codec);
 
+	if (!try_module_get(codec->dev->driver->owner))
+		return -ENODEV;
+
 	if (codec->driver->probe) {
 		ret = codec->driver->probe(codec);
 		if (ret < 0) {
 			dev_err(codec->dev,
 				"asoc: failed to probe CODEC %s: %d\n",
 				codec->name, ret);
-			return ret;
+			goto err_probe;
 		}
 	}
 
 	soc_init_codec_debugfs(codec);
 
 	/* mark codec as probed and add to card codec list */
-	if (!try_module_get(codec->dev->driver->owner))
-		return -ENODEV;
-
 	codec->probed = 1;
 	list_add(&codec->card_list, &card->codec_dev_list);
 	list_add(&codec->dapm.list, &card->dapm_list);
 
+	return 0;
+
+err_probe:
+	module_put(codec->dev->driver->owner);
+
 	return ret;
 }
 
@@ -1549,19 +1554,19 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
 
 	/* probe the platform */
 	if (!platform->probed) {
+		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 */
-
-		if (!try_module_get(platform->dev->driver->owner))
-			return -ENODEV;
-
 		platform->probed = 1;
 		list_add(&platform->card_list, &card->platform_dev_list);
 	}
-- 
1.7.2.3

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

* Re: [PATCH 0/2] ASoC: Refcount fixes
  2011-01-27 14:24 [PATCH 0/2] ASoC: Refcount fixes Jarkko Nikula
  2011-01-27 14:24 ` [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices Jarkko Nikula
  2011-01-27 14:24 ` [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing Jarkko Nikula
@ 2011-01-27 20:42 ` Liam Girdwood
  2 siblings, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2011-01-27 20:42 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown

On Thu, 2011-01-27 at 16:24 +0200, Jarkko Nikula wrote:
> Hi
> 
> Nothing new, just yesterday's refcount fix for-2.6.38 and another minor
> for-2.6.39 rebased on top of for-2.6.39 and sent together.
> 

All

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

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

* Re: [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing
  2011-01-27 14:24 ` [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing Jarkko Nikula
@ 2011-01-28 12:58   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-01-28 12:58 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: Vinod Koul, alsa-devel, Harsha Priya, Liam Girdwood

On Thu, Jan 27, 2011 at 04:24:22PM +0200, Jarkko Nikula wrote:
> Commit f6c2ed5 "ASoC: Fix the device references to codec and platform drivers"
> moved codec and platform driver refcount increments from soc_bind_dai_link
> to more appropriate places.
> 
> Adjust a little them so that refcounts are incremented before executing the
> driver probe functions.

Applied, thanks.

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

end of thread, other threads:[~2011-01-28 12:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-27 14:24 [PATCH 0/2] ASoC: Refcount fixes Jarkko Nikula
2011-01-27 14:24 ` [PATCH 1/2] ASoC: Fix module refcount for auxiliary devices Jarkko Nikula
2011-01-27 14:23   ` Mark Brown
2011-01-27 14:24 ` [PATCH 2/2] ASoC: soc-core: Increment codec and platform driver refcounts before probing Jarkko Nikula
2011-01-28 12:58   ` Mark Brown
2011-01-27 20:42 ` [PATCH 0/2] ASoC: Refcount fixes Liam Girdwood

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).