提交 77d19b10 编写于 作者: S Sachin Kamat 提交者: Mark Brown

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: NSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 9489e9dc
...@@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, ...@@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
if (ak4535 == NULL) if (ak4535 == NULL)
return -ENOMEM; return -ENOMEM;
ak4535->regmap = regmap_init_i2c(i2c, &ak4535_regmap); ak4535->regmap = devm_regmap_init_i2c(i2c, &ak4535_regmap);
if (IS_ERR(ak4535->regmap)) { if (IS_ERR(ak4535->regmap)) {
ret = PTR_ERR(ak4535->regmap); ret = PTR_ERR(ak4535->regmap);
dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); 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,18 +458,13 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
ret = snd_soc_register_codec(&i2c->dev, ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_ak4535, &ak4535_dai, 1); &soc_codec_dev_ak4535, &ak4535_dai, 1);
if (ret != 0)
regmap_exit(ak4535->regmap);
return ret; return ret;
} }
static __devexit int ak4535_i2c_remove(struct i2c_client *client) static __devexit int ak4535_i2c_remove(struct i2c_client *client)
{ {
struct ak4535_priv *ak4535 = i2c_get_clientdata(client);
snd_soc_unregister_codec(&client->dev); snd_soc_unregister_codec(&client->dev);
regmap_exit(ak4535->regmap);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册