From: Axel Lin Date: Sun, 4 Dec 2011 23:58:25 +0000 (+0800) Subject: ASoC: uda1380: Convert to gpio_request_one() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=68020db8ac1046e50c758545b75850eb356a0651;p=linux-beck.git 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: Axel Lin Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index 39c228c89e46..83e45d2b3e84 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: