aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8955.c
diff options
context:
space:
mode:
authorSachin Kamat <sachin.kamat@linaro.org>2012-11-26 06:49:42 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-01 23:09:09 -0500
commit385b27f55c9543cc4b973ed00afff7b90b3df3a4 (patch)
treef48c0565a0160b54cdf5aa8e4efab00c2b4b9e07 /sound/soc/codecs/wm8955.c
parent9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff)
ASoC: wm8955: Use devm_regmap_init_i2c()
devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8955.c')
-rw-r--r--sound/soc/codecs/wm8955.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 2f1c075755b1..7a82b7d28dcd 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -1023,7 +1023,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1023 if (wm8955 == NULL) 1023 if (wm8955 == NULL)
1024 return -ENOMEM; 1024 return -ENOMEM;
1025 1025
1026 wm8955->regmap = regmap_init_i2c(i2c, &wm8955_regmap); 1026 wm8955->regmap = devm_regmap_init_i2c(i2c, &wm8955_regmap);
1027 if (IS_ERR(wm8955->regmap)) { 1027 if (IS_ERR(wm8955->regmap)) {
1028 ret = PTR_ERR(wm8955->regmap); 1028 ret = PTR_ERR(wm8955->regmap);
1029 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 1029 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1035,22 +1035,13 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1035 1035
1036 ret = snd_soc_register_codec(&i2c->dev, 1036 ret = snd_soc_register_codec(&i2c->dev,
1037 &soc_codec_dev_wm8955, &wm8955_dai, 1); 1037 &soc_codec_dev_wm8955, &wm8955_dai, 1);
1038 if (ret != 0)
1039 goto err;
1040 1038
1041 return ret; 1039 return ret;
1042
1043err:
1044 regmap_exit(wm8955->regmap);
1045 return ret;
1046} 1040}
1047 1041
1048static __devexit int wm8955_i2c_remove(struct i2c_client *client) 1042static __devexit int wm8955_i2c_remove(struct i2c_client *client)
1049{ 1043{
1050 struct wm8955_priv *wm8955 = i2c_get_clientdata(client);
1051
1052 snd_soc_unregister_codec(&client->dev); 1044 snd_soc_unregister_codec(&client->dev);
1053 regmap_exit(wm8955->regmap);
1054 1045
1055 return 0; 1046 return 0;
1056} 1047}