diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2012-11-26 06:49:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-11-28 12:39:59 -0500 |
commit | 95a5b240e40fc7ab226e59fb8298a2ca4faf7657 (patch) | |
tree | 0b287313ff025d632d252655a34f6ba993ef2427 /sound/soc | |
parent | 9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff) |
ASoC: wm8400: Use devm_regulator_bulk_get
devm_regulator_bulk_get() 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')
-rw-r--r-- | sound/soc/codecs/wm8400.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 5d277a915f81..262c44082eb0 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c | |||
@@ -1373,7 +1373,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) | |||
1373 | codec->control_data = priv->wm8400 = wm8400; | 1373 | codec->control_data = priv->wm8400 = wm8400; |
1374 | priv->codec = codec; | 1374 | priv->codec = codec; |
1375 | 1375 | ||
1376 | ret = regulator_bulk_get(wm8400->dev, | 1376 | ret = devm_regulator_bulk_get(wm8400->dev, |
1377 | ARRAY_SIZE(power), &power[0]); | 1377 | ARRAY_SIZE(power), &power[0]); |
1378 | if (ret != 0) { | 1378 | if (ret != 0) { |
1379 | dev_err(codec->dev, "Failed to get regulators: %d\n", ret); | 1379 | dev_err(codec->dev, "Failed to get regulators: %d\n", ret); |
@@ -1398,15 +1398,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) | |||
1398 | snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1398 | snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1399 | snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); | 1399 | snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); |
1400 | 1400 | ||
1401 | if (!schedule_work(&priv->work)) { | 1401 | if (!schedule_work(&priv->work)) |
1402 | ret = -EINVAL; | 1402 | return -EINVAL; |
1403 | goto err_regulator; | ||
1404 | } | ||
1405 | return 0; | 1403 | return 0; |
1406 | |||
1407 | err_regulator: | ||
1408 | regulator_bulk_free(ARRAY_SIZE(power), power); | ||
1409 | return ret; | ||
1410 | } | 1404 | } |
1411 | 1405 | ||
1412 | static int wm8400_codec_remove(struct snd_soc_codec *codec) | 1406 | static int wm8400_codec_remove(struct snd_soc_codec *codec) |
@@ -1417,8 +1411,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec) | |||
1417 | snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1, | 1411 | snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1, |
1418 | reg & (~WM8400_CODEC_ENA)); | 1412 | reg & (~WM8400_CODEC_ENA)); |
1419 | 1413 | ||
1420 | regulator_bulk_free(ARRAY_SIZE(power), power); | ||
1421 | |||
1422 | return 0; | 1414 | return 0; |
1423 | } | 1415 | } |
1424 | 1416 | ||