diff mbox

[12/14] ASoC: wm8978: Use devm_regmap_init_i2c()

Message ID 1353930587-12907-13-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 26, 2012, 11:49 a.m. UTC
devm_regmap_init_i2c() is device managed and makes error
handling and code cleanup simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 sound/soc/codecs/wm8978.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

Comments

Mark Brown Dec. 2, 2012, 4:07 a.m. UTC | #1
On Mon, Nov 26, 2012 at 05:19:45PM +0530, Sachin Kamat wrote:
> devm_regmap_init_i2c() is device managed and makes error
> handling and code cleanup simpler.

Applied, thanks.
Sachin Kamat Dec. 6, 2012, 4:43 a.m. UTC | #2
On 2 December 2012 09:37, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Mon, Nov 26, 2012 at 05:19:45PM +0530, Sachin Kamat wrote:
>> devm_regmap_init_i2c() is device managed and makes error
>> handling and code cleanup simpler.
>
> Applied, thanks.

Mark,
Looks like this patch is missed out in your tree.
Please let me know if you want me to re-send this.
Mark Brown Dec. 6, 2012, 5:29 a.m. UTC | #3
On Thu, Dec 06, 2012 at 10:13:22AM +0530, Sachin Kamat wrote:

> Looks like this patch is missed out in your tree.
> Please let me know if you want me to re-send this.

I
can
see
it
in
my
tree
Sachin Kamat Dec. 6, 2012, 5:57 a.m. UTC | #4
On 6 December 2012 10:59, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Thu, Dec 06, 2012 at 10:13:22AM +0530, Sachin Kamat wrote:
>
>> Looks like this patch is missed out in your tree.
>> Please let me know if you want me to re-send this.
>
> I
> can
> see
> it
> in
> my
> tree

Yes, found it now. Thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 8c1dac9..ef46700 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -1046,7 +1046,7 @@  static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
 	if (wm8978 == NULL)
 		return -ENOMEM;
 
-	wm8978->regmap = regmap_init_i2c(i2c, &wm8978_regmap_config);
+	wm8978->regmap = devm_regmap_init_i2c(i2c, &wm8978_regmap_config);
 	if (IS_ERR(wm8978->regmap)) {
 		ret = PTR_ERR(wm8978->regmap);
 		dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -1059,29 +1059,22 @@  static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
 	ret = regmap_write(wm8978->regmap, WM8978_RESET, 0);
 	if (ret != 0) {
 		dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	ret = snd_soc_register_codec(&i2c->dev,
 			&soc_codec_dev_wm8978, &wm8978_dai, 1);
 	if (ret != 0) {
 		dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	return 0;
-
-err:
-	regmap_exit(wm8978->regmap);
-	return ret;
 }
 
 static __devexit int wm8978_i2c_remove(struct i2c_client *client)
 {
-	struct wm8978_priv *wm8978 = i2c_get_clientdata(client);
-
 	snd_soc_unregister_codec(&client->dev);
-	regmap_exit(wm8978->regmap);
 
 	return 0;
 }