All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component()
@ 2015-04-09 17:56 Fabio Estevam
  2015-04-09 18:32 ` Nicolin Chen
  2015-04-10 10:05 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Fabio Estevam @ 2015-04-09 17:56 UTC (permalink / raw)
  To: broonie; +Cc: nicoleotsuka, Fabio Estevam, alsa-devel, timur

Using devm_snd_soc_register_component() can make the code shorter and
cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/fsl/fsl_ssi.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 6b0c8f7..143cc16 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -1393,8 +1393,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	ret = snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
-					 &ssi_private->cpu_dai_drv, 1);
+	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
+					      &ssi_private->cpu_dai_drv, 1);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
 		goto error_asoc_register;
@@ -1407,13 +1407,13 @@ static int fsl_ssi_probe(struct platform_device *pdev)
 		if (ret < 0) {
 			dev_err(&pdev->dev, "could not claim irq %u\n",
 					ssi_private->irq);
-			goto error_irq;
+			goto error_asoc_register;
 		}
 	}
 
 	ret = fsl_ssi_debugfs_create(&ssi_private->dbg_stats, &pdev->dev);
 	if (ret)
-		goto error_irq;
+		goto error_asoc_register;
 
 	/*
 	 * If codec-handle property is missing from SSI node, we assume
@@ -1454,9 +1454,6 @@ done:
 error_sound_card:
 	fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
 
-error_irq:
-	snd_soc_unregister_component(&pdev->dev);
-
 error_asoc_register:
 	if (ssi_private->soc->imx)
 		fsl_ssi_imx_clean(pdev, ssi_private);
@@ -1472,7 +1469,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 
 	if (ssi_private->pdev)
 		platform_device_unregister(ssi_private->pdev);
-	snd_soc_unregister_component(&pdev->dev);
 
 	if (ssi_private->soc->imx)
 		fsl_ssi_imx_clean(pdev, ssi_private);
-- 
1.9.1

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

* Re: [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component()
  2015-04-09 17:56 [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component() Fabio Estevam
@ 2015-04-09 18:32 ` Nicolin Chen
  2015-04-10 10:05 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2015-04-09 18:32 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: alsa-devel, broonie, timur

On Thu, Apr 09, 2015 at 02:56:41PM -0300, Fabio Estevam wrote:
> Using devm_snd_soc_register_component() can make the code shorter and
> cleaner.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>

Thank you
Nicolin

> ---
>  sound/soc/fsl/fsl_ssi.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
> index 6b0c8f7..143cc16 100644
> --- a/sound/soc/fsl/fsl_ssi.c
> +++ b/sound/soc/fsl/fsl_ssi.c
> @@ -1393,8 +1393,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
>  			return ret;
>  	}
>  
> -	ret = snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
> -					 &ssi_private->cpu_dai_drv, 1);
> +	ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
> +					      &ssi_private->cpu_dai_drv, 1);
>  	if (ret) {
>  		dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
>  		goto error_asoc_register;
> @@ -1407,13 +1407,13 @@ static int fsl_ssi_probe(struct platform_device *pdev)
>  		if (ret < 0) {
>  			dev_err(&pdev->dev, "could not claim irq %u\n",
>  					ssi_private->irq);
> -			goto error_irq;
> +			goto error_asoc_register;
>  		}
>  	}
>  
>  	ret = fsl_ssi_debugfs_create(&ssi_private->dbg_stats, &pdev->dev);
>  	if (ret)
> -		goto error_irq;
> +		goto error_asoc_register;
>  
>  	/*
>  	 * If codec-handle property is missing from SSI node, we assume
> @@ -1454,9 +1454,6 @@ done:
>  error_sound_card:
>  	fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
>  
> -error_irq:
> -	snd_soc_unregister_component(&pdev->dev);
> -
>  error_asoc_register:
>  	if (ssi_private->soc->imx)
>  		fsl_ssi_imx_clean(pdev, ssi_private);
> @@ -1472,7 +1469,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
>  
>  	if (ssi_private->pdev)
>  		platform_device_unregister(ssi_private->pdev);
> -	snd_soc_unregister_component(&pdev->dev);
>  
>  	if (ssi_private->soc->imx)
>  		fsl_ssi_imx_clean(pdev, ssi_private);
> -- 
> 1.9.1
> 

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

* Re: [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component()
  2015-04-09 17:56 [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component() Fabio Estevam
  2015-04-09 18:32 ` Nicolin Chen
@ 2015-04-10 10:05 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-04-10 10:05 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: nicoleotsuka, alsa-devel, timur


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

On Thu, Apr 09, 2015 at 02:56:41PM -0300, Fabio Estevam wrote:
> Using devm_snd_soc_register_component() can make the code shorter and
> cleaner.

Applied, thanks.

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

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



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

end of thread, other threads:[~2015-04-10 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-09 17:56 [PATCH] ASoC: fsl_ssi: Use devm_snd_soc_register_component() Fabio Estevam
2015-04-09 18:32 ` Nicolin Chen
2015-04-10 10:05 ` 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.