diff options
author | Axel Lin <axel.lin@gmail.com> | 2011-12-04 18:58:25 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-12-05 08:24:49 -0500 |
commit | 68020db8ac1046e50c758545b75850eb356a0651 (patch) | |
tree | 25c8180e9480052041b79bc5c8733dd2b1a649e4 /sound/soc/codecs/uda1380.c | |
parent | aec60f51e5127fb750b66eb7905047c67372177f (diff) |
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 <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/uda1380.c')
-rw-r--r-- | 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 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) | |||
732 | return -EINVAL; | 732 | return -EINVAL; |
733 | 733 | ||
734 | if (gpio_is_valid(pdata->gpio_reset)) { | 734 | if (gpio_is_valid(pdata->gpio_reset)) { |
735 | ret = gpio_request(pdata->gpio_reset, "uda1380 reset"); | 735 | ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW, |
736 | "uda1380 reset"); | ||
736 | if (ret) | 737 | if (ret) |
737 | goto err_out; | 738 | goto err_out; |
738 | ret = gpio_direction_output(pdata->gpio_reset, 0); | ||
739 | if (ret) | ||
740 | goto err_gpio_reset_conf; | ||
741 | } | 739 | } |
742 | 740 | ||
743 | if (gpio_is_valid(pdata->gpio_power)) { | 741 | if (gpio_is_valid(pdata->gpio_power)) { |
744 | ret = gpio_request(pdata->gpio_power, "uda1380 power"); | 742 | ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW, |
745 | if (ret) | 743 | "uda1380 power"); |
746 | goto err_gpio; | ||
747 | ret = gpio_direction_output(pdata->gpio_power, 0); | ||
748 | if (ret) | 744 | if (ret) |
749 | goto err_gpio_power_conf; | 745 | goto err_free_gpio; |
750 | } else { | 746 | } else { |
751 | ret = uda1380_reset(codec); | 747 | ret = uda1380_reset(codec); |
752 | if (ret) { | 748 | if (ret) |
753 | dev_err(codec->dev, "Failed to issue reset\n"); | 749 | goto err_free_gpio; |
754 | goto err_reset; | ||
755 | } | ||
756 | } | 750 | } |
757 | 751 | ||
758 | INIT_WORK(&uda1380->work, uda1380_flush_work); | 752 | INIT_WORK(&uda1380->work, uda1380_flush_work); |
@@ -776,13 +770,7 @@ static int uda1380_probe(struct snd_soc_codec *codec) | |||
776 | 770 | ||
777 | return 0; | 771 | return 0; |
778 | 772 | ||
779 | err_reset: | 773 | err_free_gpio: |
780 | err_gpio_power_conf: | ||
781 | if (gpio_is_valid(pdata->gpio_power)) | ||
782 | gpio_free(pdata->gpio_power); | ||
783 | |||
784 | err_gpio_reset_conf: | ||
785 | err_gpio: | ||
786 | if (gpio_is_valid(pdata->gpio_reset)) | 774 | if (gpio_is_valid(pdata->gpio_reset)) |
787 | gpio_free(pdata->gpio_reset); | 775 | gpio_free(pdata->gpio_reset); |
788 | err_out: | 776 | err_out: |