All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: remove a card from the list, if instantiation failed
@ 2010-03-18  7:23 Guennadi Liakhovetski
  2010-03-18 11:12 ` Mark Brown
  2010-03-19 15:24 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2010-03-18  7:23 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

If instantiation of a card failed, we still have to remove it from the 
card list on unregistration. This fixes an Oops on Migo-R, triggering, 
when after a failed firmware load attempt the driver modules are removed 
and re-inserted again.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---

Mark, is this more like what you mean?

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c8b0556..f63b59a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1232,26 +1232,25 @@ static int soc_remove(struct platform_device *pdev)
 	struct snd_soc_platform *platform = card->platform;
 	struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
 
-	if (!card->instantiated)
-		return 0;
+	if (card->instantiated) {
+		run_delayed_work(&card->delayed_work);
 
-	run_delayed_work(&card->delayed_work);
+		if (platform->remove)
+			platform->remove(pdev);
 
-	if (platform->remove)
-		platform->remove(pdev);
+		if (codec_dev->remove)
+			codec_dev->remove(pdev);
 
-	if (codec_dev->remove)
-		codec_dev->remove(pdev);
+		for (i = 0; i < card->num_links; i++) {
+			struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
+			if (cpu_dai->remove)
+				cpu_dai->remove(pdev, cpu_dai);
+		}
 
-	for (i = 0; i < card->num_links; i++) {
-		struct snd_soc_dai *cpu_dai = card->dai_link[i].cpu_dai;
-		if (cpu_dai->remove)
-			cpu_dai->remove(pdev, cpu_dai);
+		if (card->remove)
+			card->remove(pdev);
 	}
 
-	if (card->remove)
-		card->remove(pdev);
-
 	snd_soc_unregister_card(card);
 
 	return 0;

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

* Re: [PATCH v2] ASoC: remove a card from the list, if instantiation failed
  2010-03-18  7:23 [PATCH v2] ASoC: remove a card from the list, if instantiation failed Guennadi Liakhovetski
@ 2010-03-18 11:12 ` Mark Brown
  2010-03-19 15:24 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-03-18 11:12 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: alsa-devel, Liam Girdwood

On Thu, Mar 18, 2010 at 08:23:33AM +0100, Guennadi Liakhovetski wrote:
> If instantiation of a card failed, we still have to remove it from the 
> card list on unregistration. This fixes an Oops on Migo-R, triggering, 
> when after a failed firmware load attempt the driver modules are removed 
> and re-inserted again.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> 
> Mark, is this more like what you mean?

Yes, it is.  I'll need to apply this and test later when I've got a
chance.

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

* Re: [PATCH v2] ASoC: remove a card from the list, if instantiation failed
  2010-03-18  7:23 [PATCH v2] ASoC: remove a card from the list, if instantiation failed Guennadi Liakhovetski
  2010-03-18 11:12 ` Mark Brown
@ 2010-03-19 15:24 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-03-19 15:24 UTC (permalink / raw)
  To: Guennadi Liakhovetski; +Cc: alsa-devel, Liam Girdwood

On Thu, Mar 18, 2010 at 08:23:33AM +0100, Guennadi Liakhovetski wrote:
> If instantiation of a card failed, we still have to remove it from the 
> card list on unregistration. This fixes an Oops on Migo-R, triggering, 
> when after a failed firmware load attempt the driver modules are removed 
> and re-inserted again.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Applied, thanks.

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

end of thread, other threads:[~2010-03-19 15:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-18  7:23 [PATCH v2] ASoC: remove a card from the list, if instantiation failed Guennadi Liakhovetski
2010-03-18 11:12 ` Mark Brown
2010-03-19 15:24 ` 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.