diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-11-26 06:49:40 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-28 12:44:34 -0500 |
commit | 2fadf6a861587ec554c4a73222d31e12003176a8 (patch) | |
tree | 8b3c8d42e8f96055a6f3826487da4e773caf07fc /sound/soc/codecs/lm49453.c | |
parent | 9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff) |
ASoC: lm49453: 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/lm49453.c')
-rw-r--r-- | sound/soc/codecs/lm49453.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c index 99b0a9dcff34..096b6aa87f0f 100644 --- a/sound/soc/codecs/lm49453.c +++ b/sound/soc/codecs/lm49453.c | |||
@@ -1497,7 +1497,7 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c, | |||
1497 | 1497 | ||
1498 | i2c_set_clientdata(i2c, lm49453); | 1498 | i2c_set_clientdata(i2c, lm49453); |
1499 | 1499 | ||
1500 | lm49453->regmap = regmap_init_i2c(i2c, &lm49453_regmap_config); | 1500 | lm49453->regmap = devm_regmap_init_i2c(i2c, &lm49453_regmap_config); |
1501 | if (IS_ERR(lm49453->regmap)) { | 1501 | if (IS_ERR(lm49453->regmap)) { |
1502 | ret = PTR_ERR(lm49453->regmap); | 1502 | ret = PTR_ERR(lm49453->regmap); |
1503 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 1503 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
@@ -1508,21 +1508,15 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c, | |||
1508 | ret = snd_soc_register_codec(&i2c->dev, | 1508 | ret = snd_soc_register_codec(&i2c->dev, |
1509 | &soc_codec_dev_lm49453, | 1509 | &soc_codec_dev_lm49453, |
1510 | lm49453_dai, ARRAY_SIZE(lm49453_dai)); | 1510 | lm49453_dai, ARRAY_SIZE(lm49453_dai)); |
1511 | if (ret < 0) { | 1511 | if (ret < 0) |
1512 | dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); | 1512 | dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); |
1513 | regmap_exit(lm49453->regmap); | ||
1514 | return ret; | ||
1515 | } | ||
1516 | 1513 | ||
1517 | return ret; | 1514 | return ret; |
1518 | } | 1515 | } |
1519 | 1516 | ||
1520 | static int __devexit lm49453_i2c_remove(struct i2c_client *client) | 1517 | static int __devexit lm49453_i2c_remove(struct i2c_client *client) |
1521 | { | 1518 | { |
1522 | struct lm49453_priv *lm49453 = i2c_get_clientdata(client); | ||
1523 | |||
1524 | snd_soc_unregister_codec(&client->dev); | 1519 | snd_soc_unregister_codec(&client->dev); |
1525 | regmap_exit(lm49453->regmap); | ||
1526 | return 0; | 1520 | return 0; |
1527 | } | 1521 | } |
1528 | 1522 | ||