Commit 68020db8 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: uda1380: Convert to gpio_request_one()

Using gpio_request_one can make the error handling simpler.

Also remove a redundant "Failed to issue reset" error message.
We already show the error message in uda1380_reset() error path.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent aec60f51
...@@ -732,27 +732,21 @@ static int uda1380_probe(struct snd_soc_codec *codec) ...@@ -732,27 +732,21 @@ static int uda1380_probe(struct snd_soc_codec *codec)
return -EINVAL; return -EINVAL;
if (gpio_is_valid(pdata->gpio_reset)) { if (gpio_is_valid(pdata->gpio_reset)) {
ret = gpio_request(pdata->gpio_reset, "uda1380 reset"); ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW,
"uda1380 reset");
if (ret) if (ret)
goto err_out; goto err_out;
ret = gpio_direction_output(pdata->gpio_reset, 0);
if (ret)
goto err_gpio_reset_conf;
} }
if (gpio_is_valid(pdata->gpio_power)) { if (gpio_is_valid(pdata->gpio_power)) {
ret = gpio_request(pdata->gpio_power, "uda1380 power"); ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW,
if (ret) "uda1380 power");
goto err_gpio;
ret = gpio_direction_output(pdata->gpio_power, 0);
if (ret) if (ret)
goto err_gpio_power_conf; goto err_free_gpio;
} else { } else {
ret = uda1380_reset(codec); ret = uda1380_reset(codec);
if (ret) { if (ret)
dev_err(codec->dev, "Failed to issue reset\n"); goto err_free_gpio;
goto err_reset;
}
} }
INIT_WORK(&uda1380->work, uda1380_flush_work); INIT_WORK(&uda1380->work, uda1380_flush_work);
...@@ -776,13 +770,7 @@ static int uda1380_probe(struct snd_soc_codec *codec) ...@@ -776,13 +770,7 @@ static int uda1380_probe(struct snd_soc_codec *codec)
return 0; return 0;
err_reset: err_free_gpio:
err_gpio_power_conf:
if (gpio_is_valid(pdata->gpio_power))
gpio_free(pdata->gpio_power);
err_gpio_reset_conf:
err_gpio:
if (gpio_is_valid(pdata->gpio_reset)) if (gpio_is_valid(pdata->gpio_reset))
gpio_free(pdata->gpio_reset); gpio_free(pdata->gpio_reset);
err_out: err_out:
......
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