Skip to content

Commit

Permalink
ASoC: ak4535: Use devm_regmap_init_i2c()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sachin Kamat authored and Mark Brown committed Nov 28, 2012
1 parent 9489e9d commit 77d19b1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions sound/soc/codecs/ak4535.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
if (ak4535 == NULL)
return -ENOMEM;

ak4535->regmap = regmap_init_i2c(i2c, &ak4535_regmap);
ak4535->regmap = devm_regmap_init_i2c(i2c, &ak4535_regmap);
if (IS_ERR(ak4535->regmap)) {
ret = PTR_ERR(ak4535->regmap);
dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
Expand All @@ -458,18 +458,13 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,

ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_ak4535, &ak4535_dai, 1);
if (ret != 0)
regmap_exit(ak4535->regmap);

return ret;
}

static __devexit int ak4535_i2c_remove(struct i2c_client *client)
{
struct ak4535_priv *ak4535 = i2c_get_clientdata(client);

snd_soc_unregister_codec(&client->dev);
regmap_exit(ak4535->regmap);
return 0;
}

Expand Down

0 comments on commit 77d19b1

Please sign in to comment.