All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
@ 2011-08-18  7:31 Axel Lin
  2011-08-18 10:14   ` Johannes Stezenbach
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Axel Lin @ 2011-08-18  7:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown, Johannes Stezenbach, alsa-devel

This patch includes below small fixes:

1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
   as we will call regulator_bulk_free() in sta32x_remove().
3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
   The i2c core will set the clientdata to NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
hi,
I don't have this hardware handy. I appreciate if someone can test this patch.

Axel
 sound/soc/codecs/sta32x.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 3d155f5..5c7def3 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -812,6 +812,7 @@ static int sta32x_remove(struct snd_soc_codec *codec)
 {
 	struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
 
+	sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
 	regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
 	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
 
@@ -871,18 +872,8 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
 static __devexit int sta32x_i2c_remove(struct i2c_client *client)
 {
 	struct sta32x_priv *sta32x = i2c_get_clientdata(client);
-	struct snd_soc_codec *codec = sta32x->codec;
-
-	if (codec)
-		sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-
-	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
-
-	if (codec) {
-		snd_soc_unregister_codec(&client->dev);
-		snd_soc_codec_set_drvdata(codec, NULL);
-	}
 
+	snd_soc_unregister_codec(&client->dev);
 	kfree(sta32x);
 	return 0;
 }
-- 
1.7.4.1




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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
  2011-08-18  7:31 [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions Axel Lin
@ 2011-08-18 10:14   ` Johannes Stezenbach
  2011-08-18 13:19   ` Liam Girdwood
  2011-08-18 16:21   ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Johannes Stezenbach @ 2011-08-18 10:14 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Liam Girdwood, Mark Brown, alsa-devel, Daniel Mack,
	Sven Neumann

On Thu, Aug 18, 2011 at 03:31:04PM +0800, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> hi,
> I don't have this hardware handy. I appreciate if someone can test this patch.
> 
> Axel

Your patch looks good, but I also don't have the hardware currently.
Maybe Sven or Daniel could test?  But even though it's untested:

Acked-by: Johannes Stezenbach <js@sig21.net>

Thanks
Johannes

>  sound/soc/codecs/sta32x.c |   13 ++-----------
>  1 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
> index 3d155f5..5c7def3 100644
> --- a/sound/soc/codecs/sta32x.c
> +++ b/sound/soc/codecs/sta32x.c
> @@ -812,6 +812,7 @@ static int sta32x_remove(struct snd_soc_codec *codec)
>  {
>  	struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
>  
> +	sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
>  	regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
>  	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
>  
> @@ -871,18 +872,8 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
>  static __devexit int sta32x_i2c_remove(struct i2c_client *client)
>  {
>  	struct sta32x_priv *sta32x = i2c_get_clientdata(client);
> -	struct snd_soc_codec *codec = sta32x->codec;
> -
> -	if (codec)
> -		sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
> -
> -	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
> -
> -	if (codec) {
> -		snd_soc_unregister_codec(&client->dev);
> -		snd_soc_codec_set_drvdata(codec, NULL);
> -	}
>  
> +	snd_soc_unregister_codec(&client->dev);
>  	kfree(sta32x);
>  	return 0;
>  }
> -- 
> 1.7.4.1
> 
> 
> 
> 

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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
@ 2011-08-18 10:14   ` Johannes Stezenbach
  0 siblings, 0 replies; 7+ messages in thread
From: Johannes Stezenbach @ 2011-08-18 10:14 UTC (permalink / raw)
  To: Axel Lin
  Cc: alsa-devel, Mark Brown, Sven Neumann, linux-kernel, Daniel Mack,
	Liam Girdwood

On Thu, Aug 18, 2011 at 03:31:04PM +0800, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> hi,
> I don't have this hardware handy. I appreciate if someone can test this patch.
> 
> Axel

Your patch looks good, but I also don't have the hardware currently.
Maybe Sven or Daniel could test?  But even though it's untested:

Acked-by: Johannes Stezenbach <js@sig21.net>

Thanks
Johannes

>  sound/soc/codecs/sta32x.c |   13 ++-----------
>  1 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
> index 3d155f5..5c7def3 100644
> --- a/sound/soc/codecs/sta32x.c
> +++ b/sound/soc/codecs/sta32x.c
> @@ -812,6 +812,7 @@ static int sta32x_remove(struct snd_soc_codec *codec)
>  {
>  	struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
>  
> +	sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
>  	regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
>  	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
>  
> @@ -871,18 +872,8 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
>  static __devexit int sta32x_i2c_remove(struct i2c_client *client)
>  {
>  	struct sta32x_priv *sta32x = i2c_get_clientdata(client);
> -	struct snd_soc_codec *codec = sta32x->codec;
> -
> -	if (codec)
> -		sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
> -
> -	regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
> -
> -	if (codec) {
> -		snd_soc_unregister_codec(&client->dev);
> -		snd_soc_codec_set_drvdata(codec, NULL);
> -	}
>  
> +	snd_soc_unregister_codec(&client->dev);
>  	kfree(sta32x);
>  	return 0;
>  }
> -- 
> 1.7.4.1
> 
> 
> 
> 

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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
  2011-08-18  7:31 [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions Axel Lin
@ 2011-08-18 13:19   ` Liam Girdwood
  2011-08-18 13:19   ` Liam Girdwood
  2011-08-18 16:21   ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2011-08-18 13:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Mark Brown, Johannes Stezenbach, alsa-devel

On 18/08/11 08:31, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Liam Girdwood <lrg@ti.com>

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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
@ 2011-08-18 13:19   ` Liam Girdwood
  0 siblings, 0 replies; 7+ messages in thread
From: Liam Girdwood @ 2011-08-18 13:19 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-kernel, alsa-devel

On 18/08/11 08:31, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Liam Girdwood <lrg@ti.com>

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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
  2011-08-18  7:31 [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions Axel Lin
@ 2011-08-18 16:21   ` Mark Brown
  2011-08-18 13:19   ` Liam Girdwood
  2011-08-18 16:21   ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-08-18 16:21 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Liam Girdwood, Johannes Stezenbach, alsa-devel

On Thu, Aug 18, 2011 at 03:31:04PM +0800, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.

Applied, thanks.

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

* Re: [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions
@ 2011-08-18 16:21   ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-08-18 16:21 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, alsa-devel, Liam Girdwood

On Thu, Aug 18, 2011 at 03:31:04PM +0800, Axel Lin wrote:
> This patch includes below small fixes:
> 
> 1. Move sta32x_set_bias_level() from sta32x_i2c_remove() to sta32x_remove().
> 2. Remove a redundant regulator_bulk_free() call in sta32x_i2c_remove(),
>    as we will call regulator_bulk_free() in sta32x_remove().
> 3. Remove unneeded snd_soc_codec_set_drvdata(codec, NULL) in sta32x_i2c_remove.
>    The i2c core will set the clientdata to NULL.

Applied, thanks.

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

end of thread, other threads:[~2011-08-18 16:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18  7:31 [PATCH] ASoC: sta32x: Move resource allocation and release to the corresponding callback functions Axel Lin
2011-08-18 10:14 ` Johannes Stezenbach
2011-08-18 10:14   ` Johannes Stezenbach
2011-08-18 13:19 ` Liam Girdwood
2011-08-18 13:19   ` Liam Girdwood
2011-08-18 16:21 ` Mark Brown
2011-08-18 16:21   ` 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.