Commit 6dff9b3b authored by Sachin Kamat's avatar Sachin Kamat Committed by Mark Brown

ASoC: wm8993: Use devm_regmap_init_i2c()

devm_regmap_init_i2c() is device managed and makes error
handling and code cleanup simpler.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 877fa971
...@@ -1660,7 +1660,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, ...@@ -1660,7 +1660,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
wm8993->dev = &i2c->dev; wm8993->dev = &i2c->dev;
init_completion(&wm8993->fll_lock); init_completion(&wm8993->fll_lock);
wm8993->regmap = regmap_init_i2c(i2c, &wm8993_regmap); wm8993->regmap = devm_regmap_init_i2c(i2c, &wm8993_regmap);
if (IS_ERR(wm8993->regmap)) { if (IS_ERR(wm8993->regmap)) {
ret = PTR_ERR(wm8993->regmap); ret = PTR_ERR(wm8993->regmap);
dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
...@@ -1676,14 +1676,14 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, ...@@ -1676,14 +1676,14 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
wm8993->supplies); wm8993->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
goto err; return ret;
} }
ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies),
wm8993->supplies); wm8993->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
goto err; return ret;
} }
ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg); ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg);
...@@ -1742,8 +1742,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, ...@@ -1742,8 +1742,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
free_irq(i2c->irq, wm8993); free_irq(i2c->irq, wm8993);
err_enable: err_enable:
regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
err:
regmap_exit(wm8993->regmap);
return ret; return ret;
} }
...@@ -1754,7 +1752,6 @@ static __devexit int wm8993_i2c_remove(struct i2c_client *i2c) ...@@ -1754,7 +1752,6 @@ static __devexit int wm8993_i2c_remove(struct i2c_client *i2c)
snd_soc_unregister_codec(&i2c->dev); snd_soc_unregister_codec(&i2c->dev);
if (i2c->irq) if (i2c->irq)
free_irq(i2c->irq, wm8993); free_irq(i2c->irq, wm8993);
regmap_exit(wm8993->regmap);
regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment