* [PATCH] ASoC: core - fix module reference counting for CPU DAIs
@ 2011-05-24 12:57 Liam Girdwood
2011-05-24 12:58 ` Liam Girdwood
2011-05-24 15:25 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-05-24 12:57 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, Liam Girdwood
Currently CODEC and platform drivers have their module reference count
incremented soc_probe_dai_link() whilst CPU DAI drivers have their reference
count incremented in soc_bind_dai_link().
CPU DAIs should have their reference count incremented in soc_probe_dai_link()
just like the CODEC and platform drivers.
Signed-off-by: Liam Girdwood <lrg@ti.com>
---
sound/soc/soc-core.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 5968745..f051e85 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1306,10 +1306,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
/* no, then find CPU DAI from registered DAIs*/
list_for_each_entry(cpu_dai, &dai_list, list) {
if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) {
-
- if (!try_module_get(cpu_dai->dev->driver->owner))
- return -ENODEV;
-
rtd->cpu_dai = cpu_dai;
goto find_codec;
}
@@ -1621,12 +1617,17 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
rtd->pmdown_time = pmdown_time;
/* probe the cpu_dai */
+
if (!cpu_dai->probed) {
+ if (!try_module_get(cpu_dai->dev->driver->owner))
+ return -ENODEV;
+
if (cpu_dai->driver->probe) {
ret = cpu_dai->driver->probe(cpu_dai);
if (ret < 0) {
printk(KERN_ERR "asoc: failed to probe CPU DAI %s\n",
cpu_dai->name);
+ module_put(cpu_dai->dev->driver->owner);
return ret;
}
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: core - fix module reference counting for CPU DAIs
2011-05-24 12:57 [PATCH] ASoC: core - fix module reference counting for CPU DAIs Liam Girdwood
@ 2011-05-24 12:58 ` Liam Girdwood
2011-05-24 15:25 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-05-24 12:58 UTC (permalink / raw)
To: Girdwood, Liam; +Cc: alsa-devel, Mark Brown
On 24/05/11 13:57, Girdwood, Liam wrote:
> Currently CODEC and platform drivers have their module reference count
> incremented soc_probe_dai_link() whilst CPU DAI drivers have their reference
> count incremented in soc_bind_dai_link().
>
> CPU DAIs should have their reference count incremented in soc_probe_dai_link()
> just like the CODEC and platform drivers.
>
> Signed-off-by: Liam Girdwood <lrg@ti.com>
> ---
> sound/soc/soc-core.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 5968745..f051e85 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1306,10 +1306,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
> /* no, then find CPU DAI from registered DAIs*/
> list_for_each_entry(cpu_dai, &dai_list, list) {
> if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) {
> -
> - if (!try_module_get(cpu_dai->dev->driver->owner))
> - return -ENODEV;
> -
> rtd->cpu_dai = cpu_dai;
> goto find_codec;
> }
> @@ -1621,12 +1617,17 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num)
> rtd->pmdown_time = pmdown_time;
>
> /* probe the cpu_dai */
> +
gah - without the newline.
> if (!cpu_dai->probed) {
> + if (!try_module_get(cpu_dai->dev->driver->owner))
> + return -ENODEV;
> +
> if (cpu_dai->driver->probe) {
> ret = cpu_dai->driver->probe(cpu_dai);
> if (ret < 0) {
> printk(KERN_ERR "asoc: failed to probe CPU DAI %s\n",
> cpu_dai->name);
> + module_put(cpu_dai->dev->driver->owner);
> return ret;
> }
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: core - fix module reference counting for CPU DAIs
2011-05-24 12:57 [PATCH] ASoC: core - fix module reference counting for CPU DAIs Liam Girdwood
2011-05-24 12:58 ` Liam Girdwood
@ 2011-05-24 15:25 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-05-24 15:25 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
On Tue, May 24, 2011 at 01:57:43PM +0100, Liam Girdwood wrote:
> Currently CODEC and platform drivers have their module reference count
> incremented soc_probe_dai_link() whilst CPU DAI drivers have their reference
> count incremented in soc_bind_dai_link().
>
> CPU DAIs should have their reference count incremented in soc_probe_dai_link()
> just like the CODEC and platform drivers.
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-24 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 12:57 [PATCH] ASoC: core - fix module reference counting for CPU DAIs Liam Girdwood
2011-05-24 12:58 ` Liam Girdwood
2011-05-24 15:25 ` 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.