Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
@ 2014-04-25  1:27 Fabio Estevam
  2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Fabio Estevam @ 2014-04-25  1:27 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@freescale.com>

Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
do not need to call regulator_bulk_free() in the error and remove paths.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/tlv320dac33.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 517055a..df3a750 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -1540,7 +1540,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
 	for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++)
 		dac33->supplies[i].supply = dac33_supply_names[i];
 
-	ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies),
+	ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies),
 				 dac33->supplies);
 
 	if (ret != 0) {
@@ -1551,11 +1551,9 @@ static int dac33_i2c_probe(struct i2c_client *client,
 	ret = snd_soc_register_codec(&client->dev,
 			&soc_codec_dev_tlv320dac33, &dac33_dai, 1);
 	if (ret < 0)
-		goto err_register;
+		goto err_get;
 
 	return ret;
-err_register:
-	regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies);
 err_get:
 	if (dac33->power_gpio >= 0)
 		gpio_free(dac33->power_gpio);
@@ -1573,8 +1571,6 @@ static int dac33_i2c_remove(struct i2c_client *client)
 	if (dac33->power_gpio >= 0)
 		gpio_free(dac33->power_gpio);
 
-	regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies);
-
 	snd_soc_unregister_codec(&client->dev);
 	return 0;
 }
-- 
1.8.3.2

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

* [PATCH 2/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
  2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
@ 2014-04-25  1:27 ` Fabio Estevam
  2014-04-25  5:39   ` Jarkko Nikula
  2014-04-25 11:23   ` Mark Brown
  2014-04-25  1:27 ` [PATCH 3/4] ASoC: wm8804: " Fabio Estevam
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: Fabio Estevam @ 2014-04-25  1:27 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@freescale.com>

Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
do not need to call regulator_bulk_free() in the error and remove paths.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/c.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index 763b265..5ada616 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -586,7 +586,7 @@ static int wm8731_probe(struct snd_soc_codec *codec)
 	for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
 		wm8731->supplies[i].supply = wm8731_supply_names[i];
 
-	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
+	ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
 				 wm8731->supplies);
 	if (ret != 0) {
 		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
@@ -597,7 +597,7 @@ static int wm8731_probe(struct snd_soc_codec *codec)
 				    wm8731->supplies);
 	if (ret != 0) {
 		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
-		goto err_regulator_get;
+		return ret;
 	}
 
 	ret = wm8731_reset(codec);
@@ -624,8 +624,6 @@ static int wm8731_probe(struct snd_soc_codec *codec)
 
 err_regulator_enable:
 	regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
-err_regulator_get:
-	regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
 
 	return ret;
 }
@@ -638,7 +636,6 @@ static int wm8731_remove(struct snd_soc_codec *codec)
 	wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
 	regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
-	regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
 
 	return 0;
 }
-- 
1.8.3.2

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

* [PATCH 3/4] ASoC: wm8804: Use devm_regulator_bulk_get()
  2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
  2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
@ 2014-04-25  1:27 ` Fabio Estevam
  2014-04-25 11:24   ` Mark Brown
  2014-04-25  1:27 ` [PATCH 4/4] ASoC: wm8955: " Fabio Estevam
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2014-04-25  1:27 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@freescale.com>

Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
do not need to call regulator_bulk_free() in the error and remove paths.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/wm8804.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 589455c..bbcad9f 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -535,7 +535,6 @@ static int wm8804_remove(struct snd_soc_codec *codec)
 	for (i = 0; i < ARRAY_SIZE(wm8804->supplies); ++i)
 		regulator_unregister_notifier(wm8804->supplies[i].consumer,
 					      &wm8804->disable_nb[i]);
-	regulator_bulk_free(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
 	return 0;
 }
 
@@ -549,7 +548,7 @@ static int wm8804_probe(struct snd_soc_codec *codec)
 	for (i = 0; i < ARRAY_SIZE(wm8804->supplies); i++)
 		wm8804->supplies[i].supply = wm8804_supply_names[i];
 
-	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8804->supplies),
+	ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8804->supplies),
 				 wm8804->supplies);
 	if (ret) {
 		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
@@ -574,7 +573,7 @@ static int wm8804_probe(struct snd_soc_codec *codec)
 				    wm8804->supplies);
 	if (ret) {
 		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
-		goto err_reg_get;
+		return ret;
 	}
 
 	id1 = snd_soc_read(codec, WM8804_RST_DEVID1);
@@ -619,8 +618,6 @@ static int wm8804_probe(struct snd_soc_codec *codec)
 
 err_reg_enable:
 	regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
-err_reg_get:
-	regulator_bulk_free(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
 	return ret;
 }
 
-- 
1.8.3.2

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

* [PATCH 4/4] ASoC: wm8955: Use devm_regulator_bulk_get()
  2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
  2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
  2014-04-25  1:27 ` [PATCH 3/4] ASoC: wm8804: " Fabio Estevam
@ 2014-04-25  1:27 ` Fabio Estevam
  2014-04-25 11:24   ` Mark Brown
  2014-04-25  5:39 ` [PATCH 1/4] ASoC: tlv320dac3: " Jarkko Nikula
  2014-04-25 11:16 ` Mark Brown
  4 siblings, 1 reply; 10+ messages in thread
From: Fabio Estevam @ 2014-04-25  1:27 UTC (permalink / raw)
  To: broonie; +Cc: Fabio Estevam, alsa-devel

From: Fabio Estevam <fabio.estevam@freescale.com>

Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
do not need to call regulator_bulk_free() in the error and remove paths.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 sound/soc/codecs/wm8955.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 7e443c4..2a35108 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -898,7 +898,7 @@ static int wm8955_probe(struct snd_soc_codec *codec)
 	for (i = 0; i < ARRAY_SIZE(wm8955->supplies); i++)
 		wm8955->supplies[i].supply = wm8955_supply_names[i];
 
-	ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8955->supplies),
+	ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8955->supplies),
 				 wm8955->supplies);
 	if (ret != 0) {
 		dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
@@ -909,7 +909,7 @@ static int wm8955_probe(struct snd_soc_codec *codec)
 				    wm8955->supplies);
 	if (ret != 0) {
 		dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
-		goto err_get;
+		return ret;
 	}
 
 	ret = wm8955_reset(codec);
@@ -961,17 +961,12 @@ static int wm8955_probe(struct snd_soc_codec *codec)
 
 err_enable:
 	regulator_bulk_disable(ARRAY_SIZE(wm8955->supplies), wm8955->supplies);
-err_get:
-	regulator_bulk_free(ARRAY_SIZE(wm8955->supplies), wm8955->supplies);
 	return ret;
 }
 
 static int wm8955_remove(struct snd_soc_codec *codec)
 {
-	struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
-
 	wm8955_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	regulator_bulk_free(ARRAY_SIZE(wm8955->supplies), wm8955->supplies);
 	return 0;
 }
 
-- 
1.8.3.2

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

* Re: [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
  2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
                   ` (2 preceding siblings ...)
  2014-04-25  1:27 ` [PATCH 4/4] ASoC: wm8955: " Fabio Estevam
@ 2014-04-25  5:39 ` Jarkko Nikula
  2014-04-25 11:16 ` Mark Brown
  4 siblings, 0 replies; 10+ messages in thread
From: Jarkko Nikula @ 2014-04-25  5:39 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

On 04/25/2014 04:27 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>   sound/soc/codecs/tlv320dac33.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
Small typo in patch title: tlv320dac3 instead of tlv320dac33.

-- 
Jarkko

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

* Re: [PATCH 2/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
  2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
@ 2014-04-25  5:39   ` Jarkko Nikula
  2014-04-25 11:23   ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Jarkko Nikula @ 2014-04-25  5:39 UTC (permalink / raw)
  To: Fabio Estevam, broonie; +Cc: Fabio Estevam, alsa-devel

On 04/25/2014 04:27 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>   sound/soc/codecs/c.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
> index 763b265..5ada616 100644
> --- a/sound/soc/codecs/wm8731.c
> +++ b/sound/soc/codecs/wm8731.c
>
Patch title, c.c (?) and wm8731.c doesn't match.

-- 
Jarkko

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

* Re: [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
  2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
                   ` (3 preceding siblings ...)
  2014-04-25  5:39 ` [PATCH 1/4] ASoC: tlv320dac3: " Jarkko Nikula
@ 2014-04-25 11:16 ` Mark Brown
  4 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2014-04-25 11:16 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel


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

On Thu, Apr 24, 2014 at 10:27:03PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.

Applied, thanks.

[-- 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] 10+ messages in thread

* Re: [PATCH 2/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
  2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
  2014-04-25  5:39   ` Jarkko Nikula
@ 2014-04-25 11:23   ` Mark Brown
  1 sibling, 0 replies; 10+ messages in thread
From: Mark Brown @ 2014-04-25 11:23 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel


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

On Thu, Apr 24, 2014 at 10:27:04PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.

Applied, thanks.

[-- 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] 10+ messages in thread

* Re: [PATCH 3/4] ASoC: wm8804: Use devm_regulator_bulk_get()
  2014-04-25  1:27 ` [PATCH 3/4] ASoC: wm8804: " Fabio Estevam
@ 2014-04-25 11:24   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2014-04-25 11:24 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel


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

On Thu, Apr 24, 2014 at 10:27:05PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.

Applied, thanks.

[-- 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] 10+ messages in thread

* Re: [PATCH 4/4] ASoC: wm8955: Use devm_regulator_bulk_get()
  2014-04-25  1:27 ` [PATCH 4/4] ASoC: wm8955: " Fabio Estevam
@ 2014-04-25 11:24   ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2014-04-25 11:24 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Fabio Estevam, alsa-devel


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

On Thu, Apr 24, 2014 at 10:27:06PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
> do not need to call regulator_bulk_free() in the error and remove paths.

Applied, thanks.

[-- 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] 10+ messages in thread

end of thread, other threads:[~2014-04-25 11:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-25  1:27 [PATCH 1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get() Fabio Estevam
2014-04-25  1:27 ` [PATCH 2/4] " Fabio Estevam
2014-04-25  5:39   ` Jarkko Nikula
2014-04-25 11:23   ` Mark Brown
2014-04-25  1:27 ` [PATCH 3/4] ASoC: wm8804: " Fabio Estevam
2014-04-25 11:24   ` Mark Brown
2014-04-25  1:27 ` [PATCH 4/4] ASoC: wm8955: " Fabio Estevam
2014-04-25 11:24   ` Mark Brown
2014-04-25  5:39 ` [PATCH 1/4] ASoC: tlv320dac3: " Jarkko Nikula
2014-04-25 11:16 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox