All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
@ 2010-10-28 11:05 Jarkko Nikula
  2010-10-28 12:43 ` Peter Ujfalusi
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jarkko Nikula @ 2010-10-28 11:05 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Peter Ujfalusi, Liam Girdwood

This driver has unbalanced regulator_disable when doing module loading and
unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
calls twice tpa6130a2_power(0). Fix this by implementing a state checking
in tpa6130a2_power.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 sound/soc/codecs/tpa6130a2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 329acc1..83b5631 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -125,7 +125,7 @@ static int tpa6130a2_power(int power)
 	data = i2c_get_clientdata(tpa6130a2_client);
 
 	mutex_lock(&data->mutex);
-	if (power) {
+	if (power && !data->power_state) {
 		/* Power on */
 		if (data->power_gpio >= 0)
 			gpio_set_value(data->power_gpio, 1);
@@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
 		val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
 		val &= ~TPA6130A2_SWS;
 		tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
-	} else {
+	} else if (!power && data->power_state) {
 		/* set SWS */
 		val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
 		val |= TPA6130A2_SWS;
-- 
1.7.1

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

* Re: [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
  2010-10-28 11:05 [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables Jarkko Nikula
@ 2010-10-28 12:43 ` Peter Ujfalusi
  2010-10-28 18:33 ` Mark Brown
  2010-11-03 14:00 ` Takashi Iwai
  2 siblings, 0 replies; 8+ messages in thread
From: Peter Ujfalusi @ 2010-10-28 12:43 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood

On Thursday 28 October 2010 14:05:40 ext Jarkko Nikula wrote:
> This driver has unbalanced regulator_disable when doing module loading and
> unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
> calls twice tpa6130a2_power(0). Fix this by implementing a state checking
> in tpa6130a2_power.

Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>

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

* Re: [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
  2010-10-28 11:05 [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables Jarkko Nikula
  2010-10-28 12:43 ` Peter Ujfalusi
@ 2010-10-28 18:33 ` Mark Brown
  2010-10-30 16:38   ` Liam Girdwood
  2010-11-03 14:00 ` Takashi Iwai
  2 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2010-10-28 18:33 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Peter Ujfalusi, Liam Girdwood

On Thu, Oct 28, 2010 at 02:05:40PM +0300, Jarkko Nikula wrote:
> This driver has unbalanced regulator_disable when doing module loading and
> unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
> calls twice tpa6130a2_power(0). Fix this by implementing a state checking
> in tpa6130a2_power.
> 
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

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

* Re: [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
  2010-10-28 18:33 ` Mark Brown
@ 2010-10-30 16:38   ` Liam Girdwood
  0 siblings, 0 replies; 8+ messages in thread
From: Liam Girdwood @ 2010-10-30 16:38 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Peter, Ujfalusi

On Thu, 2010-10-28 at 19:33 +0100, Mark Brown wrote:
> On Thu, Oct 28, 2010 at 02:05:40PM +0300, Jarkko Nikula wrote:
> > This driver has unbalanced regulator_disable when doing module loading and
> > unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
> > calls twice tpa6130a2_power(0). Fix this by implementing a state checking
> > in tpa6130a2_power.
> > 
> > Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> > Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> 
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied.

Thanks

Liam
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

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

* Re: [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
  2010-10-28 11:05 [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables Jarkko Nikula
  2010-10-28 12:43 ` Peter Ujfalusi
  2010-10-28 18:33 ` Mark Brown
@ 2010-11-03 14:00 ` Takashi Iwai
  2010-11-03 14:29   ` Jarkko Nikula
  2010-11-03 14:39   ` [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power Jarkko Nikula
  2 siblings, 2 replies; 8+ messages in thread
From: Takashi Iwai @ 2010-11-03 14:00 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown, Peter Ujfalusi, Liam Girdwood

At Thu, 28 Oct 2010 14:05:40 +0300,
Jarkko Nikula wrote:
> 
> This driver has unbalanced regulator_disable when doing module loading and
> unloading. This is because tpa6130a2_probe followed by tpa6130a2_remove
> calls twice tpa6130a2_power(0). Fix this by implementing a state checking
> in tpa6130a2_power.
> 
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> ---
>  sound/soc/codecs/tpa6130a2.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index 329acc1..83b5631 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -125,7 +125,7 @@ static int tpa6130a2_power(int power)
>  	data = i2c_get_clientdata(tpa6130a2_client);
>  
>  	mutex_lock(&data->mutex);
> -	if (power) {
> +	if (power && !data->power_state) {
>  		/* Power on */
>  		if (data->power_gpio >= 0)
>  			gpio_set_value(data->power_gpio, 1);
> @@ -153,7 +153,7 @@ static int tpa6130a2_power(int power)
>  		val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
>  		val &= ~TPA6130A2_SWS;
>  		tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
> -	} else {
> +	} else if (!power && data->power_state) {
>  		/* set SWS */
>  		val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
>  		val |= TPA6130A2_SWS;

This seems triggering a compile warning:

  sound/soc/codecs/tpa6130a2.c:122:6: warning: ‘ret’ may be used uninitialized in this function


Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables
  2010-11-03 14:00 ` Takashi Iwai
@ 2010-11-03 14:29   ` Jarkko Nikula
  2010-11-03 14:39   ` [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power Jarkko Nikula
  1 sibling, 0 replies; 8+ messages in thread
From: Jarkko Nikula @ 2010-11-03 14:29 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, Mark Brown, Peter Ujfalusi, Liam Girdwood

On Wed, 03 Nov 2010 15:00:12 +0100
Takashi Iwai <tiwai@suse.de> wrote:

> This seems triggering a compile warning:
> 
>   sound/soc/codecs/tpa6130a2.c:122:6: warning: ‘ret’ may be used uninitialized in this function
> 
My shame. I send a patch in a minute.


-- 
Jarkko
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power
  2010-11-03 14:00 ` Takashi Iwai
  2010-11-03 14:29   ` Jarkko Nikula
@ 2010-11-03 14:39   ` Jarkko Nikula
  2010-11-03 14:55     ` Takashi Iwai
  1 sibling, 1 reply; 8+ messages in thread
From: Jarkko Nikula @ 2010-11-03 14:39 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai, Mark Brown, Peter Ujfalusi, Liam Girdwood

Patch "ASoC: tpa6130a2: Fix unbalanced regulator disables" introduced a
compiler warning "‘ret’ may be used uninitialized in this function".
Initialize ret to zero to get rid of it and making sure that the function
does not return any random error code when the code is falling through.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
 sound/soc/codecs/tpa6130a2.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 83b5631..ee4fb20 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -119,7 +119,7 @@ static int tpa6130a2_power(int power)
 {
 	struct	tpa6130a2_data *data;
 	u8	val;
-	int	ret;
+	int	ret = 0;
 
 	BUG_ON(tpa6130a2_client == NULL);
 	data = i2c_get_clientdata(tpa6130a2_client);
-- 
1.7.2.3

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power
  2010-11-03 14:39   ` [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power Jarkko Nikula
@ 2010-11-03 14:55     ` Takashi Iwai
  0 siblings, 0 replies; 8+ messages in thread
From: Takashi Iwai @ 2010-11-03 14:55 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown, Peter Ujfalusi, Liam Girdwood

At Wed,  3 Nov 2010 16:39:00 +0200,
Jarkko Nikula wrote:
> 
> Patch "ASoC: tpa6130a2: Fix unbalanced regulator disables" introduced a
> compiler warning "‘ret’ may be used uninitialized in this function".
> Initialize ret to zero to get rid of it and making sure that the function
> does not return any random error code when the code is falling through.
> 
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Thanks!

Applied now directly to sound git tree as I'm going to send a pull
request soon later.

Mark, Liam, please pull back to your trees later on.


Takashi

> ---
>  sound/soc/codecs/tpa6130a2.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index 83b5631..ee4fb20 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -119,7 +119,7 @@ static int tpa6130a2_power(int power)
>  {
>  	struct	tpa6130a2_data *data;
>  	u8	val;
> -	int	ret;
> +	int	ret = 0;
>  
>  	BUG_ON(tpa6130a2_client == NULL);
>  	data = i2c_get_clientdata(tpa6130a2_client);
> -- 
> 1.7.2.3
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2010-11-03 14:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 11:05 [PATCH] ASoC: tpa6130a2: Fix unbalanced regulator disables Jarkko Nikula
2010-10-28 12:43 ` Peter Ujfalusi
2010-10-28 18:33 ` Mark Brown
2010-10-30 16:38   ` Liam Girdwood
2010-11-03 14:00 ` Takashi Iwai
2010-11-03 14:29   ` Jarkko Nikula
2010-11-03 14:39   ` [PATCH] ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power Jarkko Nikula
2010-11-03 14:55     ` Takashi Iwai

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.