* [PATCH v2] ASoC: uda1380: Convert to gpio_request_one()
@ 2011-12-04 23:58 Axel Lin
2011-12-05 13:25 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2011-12-04 23:58 UTC (permalink / raw)
To: alsa-devel; +Cc: Philipp Zabel, Mark Brown, Liam Girdwood, Lars-Peter Clausen
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: Axel Lin <axel.lin@gmail.com>
---
sound/soc/codecs/uda1380.c | 28 ++++++++--------------------
1 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 3a238cb..c1b05b7 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -732,27 +732,21 @@ static int uda1380_probe(struct snd_soc_codec *codec)
return -EINVAL;
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)
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)) {
- ret = gpio_request(pdata->gpio_power, "uda1380 power");
- if (ret)
- goto err_gpio;
- ret = gpio_direction_output(pdata->gpio_power, 0);
+ ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW,
+ "uda1380 power");
if (ret)
- goto err_gpio_power_conf;
+ goto err_free_gpio;
} else {
ret = uda1380_reset(codec);
- if (ret) {
- dev_err(codec->dev, "Failed to issue reset\n");
- goto err_reset;
- }
+ if (ret)
+ goto err_free_gpio;
}
INIT_WORK(&uda1380->work, uda1380_flush_work);
@@ -776,13 +770,7 @@ static int uda1380_probe(struct snd_soc_codec *codec)
return 0;
-err_reset:
-err_gpio_power_conf:
- if (gpio_is_valid(pdata->gpio_power))
- gpio_free(pdata->gpio_power);
-
-err_gpio_reset_conf:
-err_gpio:
+err_free_gpio:
if (gpio_is_valid(pdata->gpio_reset))
gpio_free(pdata->gpio_reset);
err_out:
--
1.7.5.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ASoC: uda1380: Convert to gpio_request_one()
2011-12-04 23:58 [PATCH v2] ASoC: uda1380: Convert to gpio_request_one() Axel Lin
@ 2011-12-05 13:25 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2011-12-05 13:25 UTC (permalink / raw)
To: Axel Lin; +Cc: alsa-devel, Lars-Peter Clausen, Liam Girdwood, Philipp Zabel
On Mon, Dec 05, 2011 at 07:58:25AM +0800, Axel Lin wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-05 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-04 23:58 [PATCH v2] ASoC: uda1380: Convert to gpio_request_one() Axel Lin
2011-12-05 13:25 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).