linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] ASoC: codec: devm_ related modifications
@ 2012-11-22  4:08 Tushar Behera
  2012-11-22  4:08 ` [PATCH 01/10] ASoC: wm8510: remove invalid free of devm_ allocated data Tushar Behera
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

This patchset includes devm_ related modifications for sound codecs.

First 2 patches fix warning for freeing of devm_ allocated data.
The next patch introduces usage of devm_kzalloc() in wm8995 codec.
Following 7 patches introduce usage of devm_regmap_init_xxx() in
remaining codecs.

Tushar Behera (10):
  ASoC: wm8510: remove invalid free of devm_ allocated data
  ASoC: wm8753: remove invalid free of devm_ allocated data
  ASoC: wm8995: Convert to use devm_kzalloc()
  ASoC: ak4104: Convert to use devm_regmap_init_spi()
  ASoC: wm8741: Convert to use devm_regmap_init_{spi,i2c}()
  ASoC: wm8753: Convert to use devm_regmap_init_{spi,i2c}()
  ASoC: wm8804: Convert to use devm_regmap_init_{spi,i2c}()
  ASoC: wm8985: Convert to use devm_regmap_init_{spi,i2c}()
  ASoC: wm8988: Convert to use devm_regmap_init_{spi,i2c}()
  ASoC: wm8995: Convert to use devm_regmap_init_{spi,i2c}()

 sound/soc/codecs/ak4104.c |   19 ++++---------------
 sound/soc/codecs/wm8510.c |    3 ---
 sound/soc/codecs/wm8741.c |    4 ++--
 sound/soc/codecs/wm8753.c |   33 ++++++---------------------------
 sound/soc/codecs/wm8804.c |   17 ++---------------
 sound/soc/codecs/wm8985.c |   30 ++++--------------------------
 sound/soc/codecs/wm8988.c |   14 ++------------
 sound/soc/codecs/wm8995.c |   40 +++++++---------------------------------
 8 files changed, 27 insertions(+), 133 deletions(-)

-- 
1.7.4.1


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

* [PATCH 01/10] ASoC: wm8510: remove invalid free of devm_ allocated data
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 02/10] ASoC: wm8753: " Tushar Behera
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Fixes following warning.
sound/soc/codecs/wm8510.c:614:1-6: WARNING: invalid free of devm_ allocated data

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8510.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index c12a54e..923e7e1 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -608,10 +608,7 @@ static int wm8510_probe(struct snd_soc_codec *codec)
 /* power down chip */
 static int wm8510_remove(struct snd_soc_codec *codec)
 {
-	struct wm8510_priv *wm8510 = snd_soc_codec_get_drvdata(codec);
-
 	wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF);
-	kfree(wm8510);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 02/10] ASoC: wm8753: remove invalid free of devm_ allocated data
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
  2012-11-22  4:08 ` [PATCH 01/10] ASoC: wm8510: remove invalid free of devm_ allocated data Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 03/10] ASoC: wm8995: Convert to use devm_kzalloc() Tushar Behera
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Fixes following warning.
sound/soc/codecs/wm8753.c:1594:1-6: WARNING: invalid free of devm_ allocated data

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8753.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 2e4a775..9914215 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1591,7 +1591,6 @@ static int __devexit wm8753_spi_remove(struct spi_device *spi)
 
 	snd_soc_unregister_codec(&spi->dev);
 	regmap_exit(wm8753->regmap);
-	kfree(wm8753);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 03/10] ASoC: wm8995: Convert to use devm_kzalloc()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
  2012-11-22  4:08 ` [PATCH 01/10] ASoC: wm8510: remove invalid free of devm_ allocated data Tushar Behera
  2012-11-22  4:08 ` [PATCH 02/10] ASoC: wm8753: " Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 04/10] ASoC: ak4104: Convert to use devm_regmap_init_spi() Tushar Behera
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8995.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 28c89b0..2eb68c1 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2261,7 +2261,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
 	struct wm8995_priv *wm8995;
 	int ret;
 
-	wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL);
+	wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL);
 	if (!wm8995)
 		return -ENOMEM;
 
@@ -2271,7 +2271,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
 	if (IS_ERR(wm8995->regmap)) {
 		ret = PTR_ERR(wm8995->regmap);
 		dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
-		goto err_alloc;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&spi->dev,
@@ -2284,8 +2284,6 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
 
 err_regmap:
 	regmap_exit(wm8995->regmap);
-err_alloc:
-	kfree(wm8995);
 
 	return ret;
 }
@@ -2295,7 +2293,6 @@ static int __devexit wm8995_spi_remove(struct spi_device *spi)
 	struct wm8995_priv *wm8995 = spi_get_drvdata(spi);
 	snd_soc_unregister_codec(&spi->dev);
 	regmap_exit(wm8995->regmap);
-	kfree(wm8995);
 	return 0;
 }
 
@@ -2316,7 +2313,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
 	struct wm8995_priv *wm8995;
 	int ret;
 
-	wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL);
+	wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL);
 	if (!wm8995)
 		return -ENOMEM;
 
@@ -2326,7 +2323,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
 	if (IS_ERR(wm8995->regmap)) {
 		ret = PTR_ERR(wm8995->regmap);
 		dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret);
-		goto err_alloc;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&i2c->dev,
@@ -2341,8 +2338,6 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
 
 err_regmap:
 	regmap_exit(wm8995->regmap);
-err_alloc:
-	kfree(wm8995);
 
 	return ret;
 }
@@ -2353,7 +2348,6 @@ static __devexit int wm8995_i2c_remove(struct i2c_client *client)
 
 	snd_soc_unregister_codec(&client->dev);
 	regmap_exit(wm8995->regmap);
-	kfree(wm8995);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 04/10] ASoC: ak4104: Convert to use devm_regmap_init_spi()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (2 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 03/10] ASoC: wm8995: Convert to use devm_kzalloc() Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 05/10] ASoC: wm8741: Convert to use devm_regmap_init_{spi,i2c}() Tushar Behera
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/ak4104.c |   19 ++++---------------
 1 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index eec086b..4b11b82 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -222,7 +222,7 @@ static int ak4104_spi_probe(struct spi_device *spi)
 	if (ak4104 == NULL)
 		return -ENOMEM;
 
-	ak4104->regmap = regmap_init_spi(spi, &ak4104_regmap);
+	ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
 	if (IS_ERR(ak4104->regmap)) {
 		ret = PTR_ERR(ak4104->regmap);
 		return ret;
@@ -247,30 +247,19 @@ static int ak4104_spi_probe(struct spi_device *spi)
 	 * the device, but there is no hardware ID register. */
 	ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
 	if (ret != 0)
-		goto err;
-	if (val != AK4104_RESERVED_VAL) {
-		ret = -ENODEV;
-		goto err;
-	}
+		return ret;
+	if (val != AK4104_RESERVED_VAL)
+		return -ENODEV;
 
 	spi_set_drvdata(spi, ak4104);
 
 	ret = snd_soc_register_codec(&spi->dev,
 			&soc_codec_device_ak4104, &ak4104_dai, 1);
-	if (ret != 0)
-		goto err;
-
-	return 0;
-
-err:
-	regmap_exit(ak4104->regmap);
 	return ret;
 }
 
 static int __devexit ak4104_spi_remove(struct spi_device *spi)
 {
-	struct ak4104_private *ak4101 = spi_get_drvdata(spi);
-	regmap_exit(ak4101->regmap);
 	snd_soc_unregister_codec(&spi->dev);
 	return 0;
 }
-- 
1.7.4.1


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

* [PATCH 05/10] ASoC: wm8741: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (3 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 04/10] ASoC: ak4104: Convert to use devm_regmap_init_spi() Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 06/10] ASoC: wm8753: " Tushar Behera
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8741.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 4281a08..99b8ebe 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -522,7 +522,7 @@ static int wm8741_i2c_probe(struct i2c_client *i2c,
 		return ret;
 	}
 
-	wm8741->regmap = regmap_init_i2c(i2c, &wm8741_regmap);
+	wm8741->regmap = devm_regmap_init_i2c(i2c, &wm8741_regmap);
 	if (IS_ERR(wm8741->regmap)) {
 		ret = PTR_ERR(wm8741->regmap);
 		dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
@@ -582,7 +582,7 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	wm8741->regmap = regmap_init_spi(spi, &wm8741_regmap);
+	wm8741->regmap = devm_regmap_init_spi(spi, &wm8741_regmap);
 	if (IS_ERR(wm8741->regmap)) {
 		ret = PTR_ERR(wm8741->regmap);
 		dev_err(&spi->dev, "Failed to init regmap: %d\n", ret);
-- 
1.7.4.1


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

* [PATCH 06/10] ASoC: wm8753: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (4 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 05/10] ASoC: wm8741: Convert to use devm_regmap_init_{spi,i2c}() Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 07/10] ASoC: wm8804: " Tushar Behera
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8753.c |   32 ++++++--------------------------
 1 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 9914215..50a5dc7 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1562,35 +1562,25 @@ static int __devinit wm8753_spi_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, wm8753);
 
-	wm8753->regmap = regmap_init_spi(spi, &wm8753_regmap);
+	wm8753->regmap = devm_regmap_init_spi(spi, &wm8753_regmap);
 	if (IS_ERR(wm8753->regmap)) {
 		ret = PTR_ERR(wm8753->regmap);
 		dev_err(&spi->dev, "Failed to allocate register map: %d\n",
 			ret);
-		goto err;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8753,
 				     wm8753_dai, ARRAY_SIZE(wm8753_dai));
-	if (ret != 0) {
+	if (ret != 0)
 		dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
-		goto err_regmap;
-	}
 
-	return 0;
-
-err_regmap:
-	regmap_exit(wm8753->regmap);
-err:
 	return ret;
 }
 
 static int __devexit wm8753_spi_remove(struct spi_device *spi)
 {
-	struct wm8753_priv *wm8753 = spi_get_drvdata(spi);
-
 	snd_soc_unregister_codec(&spi->dev);
-	regmap_exit(wm8753->regmap);
 	return 0;
 }
 
@@ -1619,35 +1609,25 @@ static __devinit int wm8753_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, wm8753);
 
-	wm8753->regmap = regmap_init_i2c(i2c, &wm8753_regmap);
+	wm8753->regmap = devm_regmap_init_i2c(i2c, &wm8753_regmap);
 	if (IS_ERR(wm8753->regmap)) {
 		ret = PTR_ERR(wm8753->regmap);
 		dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
 			ret);
-		goto err;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8753,
 				     wm8753_dai, ARRAY_SIZE(wm8753_dai));
-	if (ret != 0) {
+	if (ret != 0)
 		dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
-		goto err_regmap;
-	}
 
-	return 0;
-
-err_regmap:
-	regmap_exit(wm8753->regmap);
-err:
 	return ret;
 }
 
 static __devexit int wm8753_i2c_remove(struct i2c_client *client)
 {
-	struct wm8753_priv *wm8753 = i2c_get_clientdata(client);
-
 	snd_soc_unregister_codec(&client->dev);
-	regmap_exit(wm8753->regmap);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 07/10] ASoC: wm8804: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (5 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 06/10] ASoC: wm8753: " Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 08/10] ASoC: wm8985: " Tushar Behera
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8804.c |   17 ++---------------
 1 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index c088020..837bfb5 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -711,7 +711,7 @@ static int __devinit wm8804_spi_probe(struct spi_device *spi)
 	if (!wm8804)
 		return -ENOMEM;
 
-	wm8804->regmap = regmap_init_spi(spi, &wm8804_regmap_config);
+	wm8804->regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config);
 	if (IS_ERR(wm8804->regmap)) {
 		ret = PTR_ERR(wm8804->regmap);
 		return ret;
@@ -727,9 +727,7 @@ static int __devinit wm8804_spi_probe(struct spi_device *spi)
 
 static int __devexit wm8804_spi_remove(struct spi_device *spi)
 {
-	struct wm8804_priv *wm8804 = spi_get_drvdata(spi);
 	snd_soc_unregister_codec(&spi->dev);
-	regmap_exit(wm8804->regmap);
 	return 0;
 }
 
@@ -755,7 +753,7 @@ static __devinit int wm8804_i2c_probe(struct i2c_client *i2c,
 	if (!wm8804)
 		return -ENOMEM;
 
-	wm8804->regmap = regmap_init_i2c(i2c, &wm8804_regmap_config);
+	wm8804->regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
 	if (IS_ERR(wm8804->regmap)) {
 		ret = PTR_ERR(wm8804->regmap);
 		return ret;
@@ -765,23 +763,12 @@ static __devinit int wm8804_i2c_probe(struct i2c_client *i2c,
 
 	ret = snd_soc_register_codec(&i2c->dev,
 				     &soc_codec_dev_wm8804, &wm8804_dai, 1);
-	if (ret != 0)
-		goto err;
-
-	return 0;
-
-err:
-	regmap_exit(wm8804->regmap);
 	return ret;
 }
 
 static __devexit int wm8804_i2c_remove(struct i2c_client *i2c)
 {
-	struct wm8804_priv *wm8804 = i2c_get_clientdata(i2c);
-
 	snd_soc_unregister_codec(&i2c->dev);
-	regmap_exit(wm8804->regmap);
-
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 08/10] ASoC: wm8985: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (6 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 07/10] ASoC: wm8804: " Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 09/10] ASoC: wm8988: " Tushar Behera
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8985.c |   30 ++++--------------------------
 1 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index 14f6663..7b3f409 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -1122,33 +1122,22 @@ static int __devinit wm8985_spi_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, wm8985);
 
-	wm8985->regmap = regmap_init_spi(spi, &wm8985_regmap);
+	wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap);
 	if (IS_ERR(wm8985->regmap)) {
 		ret = PTR_ERR(wm8985->regmap);
 		dev_err(&spi->dev, "Failed to allocate register map: %d\n",
 			ret);
-		goto err;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&spi->dev,
 				     &soc_codec_dev_wm8985, &wm8985_dai, 1);
-	if (ret != 0)
-		goto err;
-
-	return 0;
-
-err:
-	regmap_exit(wm8985->regmap);
 	return ret;
 }
 
 static int __devexit wm8985_spi_remove(struct spi_device *spi)
 {
-	struct wm8985_priv *wm8985 = spi_get_drvdata(spi);
-
 	snd_soc_unregister_codec(&spi->dev);
-	regmap_exit(wm8985->regmap);
-
 	return 0;
 }
 
@@ -1175,33 +1164,22 @@ static __devinit int wm8985_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, wm8985);
 
-	wm8985->regmap = regmap_init_i2c(i2c, &wm8985_regmap);
+	wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap);
 	if (IS_ERR(wm8985->regmap)) {
 		ret = PTR_ERR(wm8985->regmap);
 		dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
 			ret);
-		goto err;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&i2c->dev,
 				     &soc_codec_dev_wm8985, &wm8985_dai, 1);
-	if (ret != 0)
-		goto err;
-
-	return 0;
-
-err:
-	regmap_exit(wm8985->regmap);
 	return ret;
 }
 
 static __devexit int wm8985_i2c_remove(struct i2c_client *i2c)
 {
-	struct wm8985_priv *wm8985 = i2c_get_clientdata(i2c);
-
 	snd_soc_unregister_codec(&i2c->dev);
-	regmap_exit(wm8985->regmap);
-
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 09/10] ASoC: wm8988: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (7 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 08/10] ASoC: wm8985: " Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-22  4:08 ` [PATCH 10/10] ASoC: wm8995: " Tushar Behera
  2012-11-23 14:37 ` [PATCH 00/10] ASoC: codec: devm_ related modifications Mark Brown
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8988.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 1d4c5cf..715788d 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -882,7 +882,7 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
 	if (wm8988 == NULL)
 		return -ENOMEM;
 
-	wm8988->regmap = regmap_init_spi(spi, &wm8988_regmap);
+	wm8988->regmap = devm_regmap_init_spi(spi, &wm8988_regmap);
 	if (IS_ERR(wm8988->regmap)) {
 		ret = PTR_ERR(wm8988->regmap);
 		dev_err(&spi->dev, "Failed to init regmap: %d\n", ret);
@@ -893,17 +893,12 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
 
 	ret = snd_soc_register_codec(&spi->dev,
 			&soc_codec_dev_wm8988, &wm8988_dai, 1);
-	if (ret != 0)
-		regmap_exit(wm8988->regmap);
-
 	return ret;
 }
 
 static int __devexit wm8988_spi_remove(struct spi_device *spi)
 {
-	struct wm8988_priv *wm8988 = spi_get_drvdata(spi);
 	snd_soc_unregister_codec(&spi->dev);
-	regmap_exit(wm8988->regmap);
 	return 0;
 }
 
@@ -931,7 +926,7 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, wm8988);
 
-	wm8988->regmap = regmap_init_i2c(i2c, &wm8988_regmap);
+	wm8988->regmap = devm_regmap_init_i2c(i2c, &wm8988_regmap);
 	if (IS_ERR(wm8988->regmap)) {
 		ret = PTR_ERR(wm8988->regmap);
 		dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
@@ -940,17 +935,12 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
 
 	ret =  snd_soc_register_codec(&i2c->dev,
 			&soc_codec_dev_wm8988, &wm8988_dai, 1);
-	if (ret != 0)
-		regmap_exit(wm8988->regmap);
-
 	return ret;
 }
 
 static __devexit int wm8988_i2c_remove(struct i2c_client *client)
 {
-	struct wm8988_priv *wm8988 = i2c_get_clientdata(client);
 	snd_soc_unregister_codec(&client->dev);
-	regmap_exit(wm8988->regmap);
 	return 0;
 }
 
-- 
1.7.4.1


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

* [PATCH 10/10] ASoC: wm8995: Convert to use devm_regmap_init_{spi,i2c}()
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (8 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 09/10] ASoC: wm8988: " Tushar Behera
@ 2012-11-22  4:08 ` Tushar Behera
  2012-11-23 14:37 ` [PATCH 00/10] ASoC: codec: devm_ related modifications Mark Brown
  10 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-22  4:08 UTC (permalink / raw)
  To: linux-kernel, alsa-devel, patches; +Cc: broonie, patches

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 sound/soc/codecs/wm8995.c |   26 +++-----------------------
 1 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 2eb68c1..f1a7cf1 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2267,7 +2267,7 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, wm8995);
 
-	wm8995->regmap = regmap_init_spi(spi, &wm8995_regmap);
+	wm8995->regmap = devm_regmap_init_spi(spi, &wm8995_regmap);
 	if (IS_ERR(wm8995->regmap)) {
 		ret = PTR_ERR(wm8995->regmap);
 		dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
@@ -2277,22 +2277,12 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
 	ret = snd_soc_register_codec(&spi->dev,
 				     &soc_codec_dev_wm8995, wm8995_dai,
 				     ARRAY_SIZE(wm8995_dai));
-	if (ret < 0)
-		goto err_regmap;
-
-	return ret;
-
-err_regmap:
-	regmap_exit(wm8995->regmap);
-
 	return ret;
 }
 
 static int __devexit wm8995_spi_remove(struct spi_device *spi)
 {
-	struct wm8995_priv *wm8995 = spi_get_drvdata(spi);
 	snd_soc_unregister_codec(&spi->dev);
-	regmap_exit(wm8995->regmap);
 	return 0;
 }
 
@@ -2319,7 +2309,7 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
 
 	i2c_set_clientdata(i2c, wm8995);
 
-	wm8995->regmap = regmap_init_i2c(i2c, &wm8995_regmap);
+	wm8995->regmap = devm_regmap_init_i2c(i2c, &wm8995_regmap);
 	if (IS_ERR(wm8995->regmap)) {
 		ret = PTR_ERR(wm8995->regmap);
 		dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret);
@@ -2329,25 +2319,15 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
 	ret = snd_soc_register_codec(&i2c->dev,
 				     &soc_codec_dev_wm8995, wm8995_dai,
 				     ARRAY_SIZE(wm8995_dai));
-	if (ret < 0) {
+	if (ret < 0)
 		dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
-		goto err_regmap;
-	}
-
-	return ret;
-
-err_regmap:
-	regmap_exit(wm8995->regmap);
 
 	return ret;
 }
 
 static __devexit int wm8995_i2c_remove(struct i2c_client *client)
 {
-	struct wm8995_priv *wm8995 = i2c_get_clientdata(client);
-
 	snd_soc_unregister_codec(&client->dev);
-	regmap_exit(wm8995->regmap);
 	return 0;
 }
 
-- 
1.7.4.1


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

* Re: [PATCH 00/10] ASoC: codec: devm_ related modifications
  2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
                   ` (9 preceding siblings ...)
  2012-11-22  4:08 ` [PATCH 10/10] ASoC: wm8995: " Tushar Behera
@ 2012-11-23 14:37 ` Mark Brown
  2012-11-26  3:24   ` Tushar Behera
  10 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2012-11-23 14:37 UTC (permalink / raw)
  To: Tushar Behera; +Cc: linux-kernel, alsa-devel, patches, patches

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

On Thu, Nov 22, 2012 at 09:38:32AM +0530, Tushar Behera wrote:
> This patchset includes devm_ related modifications for sound codecs.
> 
> First 2 patches fix warning for freeing of devm_ allocated data.
> The next patch introduces usage of devm_kzalloc() in wm8995 codec.
> Following 7 patches introduce usage of devm_regmap_init_xxx() in
> remaining codecs.

Applied all, thanks.  If you're doing stuff like this it's helpful to
sort by part.

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

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

* Re: [PATCH 00/10] ASoC: codec: devm_ related modifications
  2012-11-23 14:37 ` [PATCH 00/10] ASoC: codec: devm_ related modifications Mark Brown
@ 2012-11-26  3:24   ` Tushar Behera
  0 siblings, 0 replies; 13+ messages in thread
From: Tushar Behera @ 2012-11-26  3:24 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-kernel, alsa-devel, patches, patches

On 11/23/2012 08:07 PM, Mark Brown wrote:
> On Thu, Nov 22, 2012 at 09:38:32AM +0530, Tushar Behera wrote:
>> This patchset includes devm_ related modifications for sound codecs.
>>
>> First 2 patches fix warning for freeing of devm_ allocated data.
>> The next patch introduces usage of devm_kzalloc() in wm8995 codec.
>> Following 7 patches introduce usage of devm_regmap_init_xxx() in
>> remaining codecs.
> 
> Applied all, thanks.  If you're doing stuff like this it's helpful to
> sort by part.
> 
Thanks. I will keep that in mind.

-- 
Tushar Behera

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

end of thread, other threads:[~2012-11-26  3:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-22  4:08 [PATCH 00/10] ASoC: codec: devm_ related modifications Tushar Behera
2012-11-22  4:08 ` [PATCH 01/10] ASoC: wm8510: remove invalid free of devm_ allocated data Tushar Behera
2012-11-22  4:08 ` [PATCH 02/10] ASoC: wm8753: " Tushar Behera
2012-11-22  4:08 ` [PATCH 03/10] ASoC: wm8995: Convert to use devm_kzalloc() Tushar Behera
2012-11-22  4:08 ` [PATCH 04/10] ASoC: ak4104: Convert to use devm_regmap_init_spi() Tushar Behera
2012-11-22  4:08 ` [PATCH 05/10] ASoC: wm8741: Convert to use devm_regmap_init_{spi,i2c}() Tushar Behera
2012-11-22  4:08 ` [PATCH 06/10] ASoC: wm8753: " Tushar Behera
2012-11-22  4:08 ` [PATCH 07/10] ASoC: wm8804: " Tushar Behera
2012-11-22  4:08 ` [PATCH 08/10] ASoC: wm8985: " Tushar Behera
2012-11-22  4:08 ` [PATCH 09/10] ASoC: wm8988: " Tushar Behera
2012-11-22  4:08 ` [PATCH 10/10] ASoC: wm8995: " Tushar Behera
2012-11-23 14:37 ` [PATCH 00/10] ASoC: codec: devm_ related modifications Mark Brown
2012-11-26  3:24   ` Tushar Behera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).