diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-11-26 06:49:41 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-01 23:08:32 -0500 |
commit | 8f255e7ba30397bcf3c997dd3f34e24b85616176 (patch) | |
tree | 534e3217638c20d5a4b39cbab21ea9ec0e3e3143 /sound/soc/codecs/max9768.c | |
parent | 9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff) |
ASoC: max9768: 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/max9768.c')
-rw-r--r-- | sound/soc/codecs/max9768.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c index 17b3ec2d05cb..a777de6a1b23 100644 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c | |||
@@ -187,7 +187,7 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client, | |||
187 | 187 | ||
188 | i2c_set_clientdata(client, max9768); | 188 | i2c_set_clientdata(client, max9768); |
189 | 189 | ||
190 | max9768->regmap = regmap_init_i2c(client, &max9768_i2c_regmap_config); | 190 | max9768->regmap = devm_regmap_init_i2c(client, &max9768_i2c_regmap_config); |
191 | if (IS_ERR(max9768->regmap)) { | 191 | if (IS_ERR(max9768->regmap)) { |
192 | err = PTR_ERR(max9768->regmap); | 192 | err = PTR_ERR(max9768->regmap); |
193 | goto err_gpio_free; | 193 | goto err_gpio_free; |
@@ -195,12 +195,10 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client, | |||
195 | 195 | ||
196 | err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); | 196 | err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); |
197 | if (err) | 197 | if (err) |
198 | goto err_regmap_free; | 198 | goto err_gpio_free; |
199 | 199 | ||
200 | return 0; | 200 | return 0; |
201 | 201 | ||
202 | err_regmap_free: | ||
203 | regmap_exit(max9768->regmap); | ||
204 | err_gpio_free: | 202 | err_gpio_free: |
205 | if (gpio_is_valid(max9768->shdn_gpio)) | 203 | if (gpio_is_valid(max9768->shdn_gpio)) |
206 | gpio_free(max9768->shdn_gpio); | 204 | gpio_free(max9768->shdn_gpio); |
@@ -215,7 +213,6 @@ static int __devexit max9768_i2c_remove(struct i2c_client *client) | |||
215 | struct max9768 *max9768 = i2c_get_clientdata(client); | 213 | struct max9768 *max9768 = i2c_get_clientdata(client); |
216 | 214 | ||
217 | snd_soc_unregister_codec(&client->dev); | 215 | snd_soc_unregister_codec(&client->dev); |
218 | regmap_exit(max9768->regmap); | ||
219 | 216 | ||
220 | if (gpio_is_valid(max9768->shdn_gpio)) | 217 | if (gpio_is_valid(max9768->shdn_gpio)) |
221 | gpio_free(max9768->shdn_gpio); | 218 | gpio_free(max9768->shdn_gpio); |