diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-11-26 06:49:38 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-28 12:41:54 -0500 |
commit | 77d19b10a45504af3810681d33b9ebfdb3a57a35 (patch) | |
tree | a0eac74aaf1add01c38cf393235548eb7a370a41 /sound/soc/codecs/ak4535.c | |
parent | 9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff) |
ASoC: ak4535: 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/ak4535.c')
-rw-r--r-- | sound/soc/codecs/ak4535.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 618fdc30f73e..fc5581063b2d 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c | |||
@@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, | |||
447 | if (ak4535 == NULL) | 447 | if (ak4535 == NULL) |
448 | return -ENOMEM; | 448 | return -ENOMEM; |
449 | 449 | ||
450 | ak4535->regmap = regmap_init_i2c(i2c, &ak4535_regmap); | 450 | ak4535->regmap = devm_regmap_init_i2c(i2c, &ak4535_regmap); |
451 | if (IS_ERR(ak4535->regmap)) { | 451 | if (IS_ERR(ak4535->regmap)) { |
452 | ret = PTR_ERR(ak4535->regmap); | 452 | ret = PTR_ERR(ak4535->regmap); |
453 | dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); | 453 | dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); |
@@ -458,18 +458,13 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, | |||
458 | 458 | ||
459 | ret = snd_soc_register_codec(&i2c->dev, | 459 | ret = snd_soc_register_codec(&i2c->dev, |
460 | &soc_codec_dev_ak4535, &ak4535_dai, 1); | 460 | &soc_codec_dev_ak4535, &ak4535_dai, 1); |
461 | if (ret != 0) | ||
462 | regmap_exit(ak4535->regmap); | ||
463 | 461 | ||
464 | return ret; | 462 | return ret; |
465 | } | 463 | } |
466 | 464 | ||
467 | static __devexit int ak4535_i2c_remove(struct i2c_client *client) | 465 | static __devexit int ak4535_i2c_remove(struct i2c_client *client) |
468 | { | 466 | { |
469 | struct ak4535_priv *ak4535 = i2c_get_clientdata(client); | ||
470 | |||
471 | snd_soc_unregister_codec(&client->dev); | 467 | snd_soc_unregister_codec(&client->dev); |
472 | regmap_exit(ak4535->regmap); | ||
473 | return 0; | 468 | return 0; |
474 | } | 469 | } |
475 | 470 | ||