All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/4] ASoc: kirkwood: simplify probe error
@ 2013-07-25  9:13 Jean-Francois Moine
  2013-07-25 19:10 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Francois Moine @ 2013-07-25  9:13 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Rob Herring, Russell King, alsa-devel, linux-kernel, devicetree

The function kirkwood_i2s_dev_remove() may be used when probe fails.

Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
 sound/soc/kirkwood/kirkwood-i2s.c | 44 +++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 4c9dad3..d3e50af 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -455,6 +455,21 @@ static const struct snd_soc_component_driver kirkwood_i2s_component = {
 	.name		= DRV_NAME,
 };
 
+static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
+{
+	struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
+
+	snd_soc_unregister_component(&pdev->dev);
+
+	if (!IS_ERR(priv->extclk)) {
+		clk_disable_unprepare(priv->extclk);
+		clk_put(priv->extclk);
+	}
+	clk_disable_unprepare(priv->clk);
+
+	return 0;
+}
+
 static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 {
 	struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
@@ -525,34 +540,17 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
 
 	err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
 					 soc_dai, 1);
-	if (!err)
-		return 0;
-	dev_err(&pdev->dev, "snd_soc_register_component failed\n");
-
-	if (!IS_ERR(priv->extclk)) {
-		clk_disable_unprepare(priv->extclk);
-		clk_put(priv->extclk);
+	if (err) {
+		dev_err(&pdev->dev, "snd_soc_register_component failed\n");
+		goto fail;
 	}
-	clk_disable_unprepare(priv->clk);
+	return 0;
 
+fail:
+	kirkwood_i2s_dev_remove(pdev);
 	return err;
 }
 
-static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
-{
-	struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
-
-	snd_soc_unregister_component(&pdev->dev);
-
-	if (!IS_ERR(priv->extclk)) {
-		clk_disable_unprepare(priv->extclk);
-		clk_put(priv->extclk);
-	}
-	clk_disable_unprepare(priv->clk);
-
-	return 0;
-}
-
 static struct platform_driver kirkwood_i2s_driver = {
 	.probe  = kirkwood_i2s_dev_probe,
 	.remove = kirkwood_i2s_dev_remove,
-- 
1.8.3.2



-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

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

* Re: [PATCH 2/4] ASoc: kirkwood: simplify probe error
  2013-07-25  9:13 [PATCH 2/4] ASoc: kirkwood: simplify probe error Jean-Francois Moine
@ 2013-07-25 19:10 ` Mark Brown
  2013-07-26  6:28   ` Jean-Francois Moine
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2013-07-25 19:10 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Rob Herring,
	Russell King, alsa-devel, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

On Thu, Jul 25, 2013 at 11:13:57AM +0200, Jean-Francois Moine wrote:
> The function kirkwood_i2s_dev_remove() may be used when probe fails.

This seems fine but doesn't apply against current code but otherwise
seems fine.

> +	if (!IS_ERR(priv->extclk)) {
> +		clk_disable_unprepare(priv->extclk);
> +		clk_put(priv->extclk);
> +	}

Could use devm_clk_get() for extclk.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/4] ASoc: kirkwood: simplify probe error
  2013-07-25 19:10 ` Mark Brown
@ 2013-07-26  6:28   ` Jean-Francois Moine
  2013-07-26 10:32       ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Francois Moine @ 2013-07-26  6:28 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Rob Herring,
	Russell King, alsa-devel, linux-kernel, devicetree

On Thu, 25 Jul 2013 20:10:59 +0100
Mark Brown <broonie@kernel.org> wrote:

> On Thu, Jul 25, 2013 at 11:13:57AM +0200, Jean-Francois Moine wrote:
> > The function kirkwood_i2s_dev_remove() may be used when probe fails.
> 
> This seems fine but doesn't apply against current code but otherwise
> seems fine.

My base is 3.11-rc2.

> > +	if (!IS_ERR(priv->extclk)) {
> > +		clk_disable_unprepare(priv->extclk);
> > +		clk_put(priv->extclk);
> > +	}
> 
> Could use devm_clk_get() for extclk.

I will do it.

-- 
Ken ar c'hentañ	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/

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

* Re: [PATCH 2/4] ASoc: kirkwood: simplify probe error
  2013-07-26  6:28   ` Jean-Francois Moine
@ 2013-07-26 10:32       ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-07-26 10:32 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Rob Herring,
	Russell King, alsa-devel, linux-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

On Fri, Jul 26, 2013 at 08:28:18AM +0200, Jean-Francois Moine wrote:
> Mark Brown <broonie@kernel.org> wrote:

> > This seems fine but doesn't apply against current code but otherwise
> > seems fine.

> My base is 3.11-rc2.

Always submit against where the code will be applied - -next in this
case.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/4] ASoc: kirkwood: simplify probe error
@ 2013-07-26 10:32       ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-07-26 10:32 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: devicetree, alsa-devel, Takashi Iwai, linux-kernel,
	Liam Girdwood, Rob Herring, Russell King


[-- Attachment #1.1: Type: text/plain, Size: 300 bytes --]

On Fri, Jul 26, 2013 at 08:28:18AM +0200, Jean-Francois Moine wrote:
> Mark Brown <broonie@kernel.org> wrote:

> > This seems fine but doesn't apply against current code but otherwise
> > seems fine.

> My base is 3.11-rc2.

Always submit against where the code will be applied - -next in this
case.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2013-07-26 10:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-25  9:13 [PATCH 2/4] ASoc: kirkwood: simplify probe error Jean-Francois Moine
2013-07-25 19:10 ` Mark Brown
2013-07-26  6:28   ` Jean-Francois Moine
2013-07-26 10:32     ` Mark Brown
2013-07-26 10:32       ` 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.