Commit 79ee820d authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Liam Girdwood

ASoC: tlv320aic3x: Use gpio_is_valid in checking for valid gpio_reset

I promised to convert this at some point.
Signed-off-by: default avatarJarkko Nikula <jhnikula@gmail.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 33ee617f
...@@ -1075,7 +1075,7 @@ static int aic3x_regulator_event(struct notifier_block *nb, ...@@ -1075,7 +1075,7 @@ static int aic3x_regulator_event(struct notifier_block *nb,
* Put codec to reset and require cache sync as at least one * Put codec to reset and require cache sync as at least one
* of the supplies was disabled * of the supplies was disabled
*/ */
if (aic3x->gpio_reset >= 0) if (gpio_is_valid(aic3x->gpio_reset))
gpio_set_value(aic3x->gpio_reset, 0); gpio_set_value(aic3x->gpio_reset, 0);
aic3x->codec->cache_sync = 1; aic3x->codec->cache_sync = 1;
} }
...@@ -1102,7 +1102,7 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power) ...@@ -1102,7 +1102,7 @@ static int aic3x_set_power(struct snd_soc_codec *codec, int power)
if (!codec->cache_sync) if (!codec->cache_sync)
goto out; goto out;
if (aic3x->gpio_reset >= 0) { if (gpio_is_valid(aic3x->gpio_reset)) {
udelay(1); udelay(1);
gpio_set_value(aic3x->gpio_reset, 1); gpio_set_value(aic3x->gpio_reset, 1);
} }
...@@ -1359,7 +1359,7 @@ static int aic3x_probe(struct snd_soc_codec *codec) ...@@ -1359,7 +1359,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
if (aic3x->gpio_reset >= 0) { if (gpio_is_valid(aic3x->gpio_reset)) {
ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset"); ret = gpio_request(aic3x->gpio_reset, "tlv320aic3x reset");
if (ret != 0) if (ret != 0)
goto err_gpio; goto err_gpio;
...@@ -1414,7 +1414,7 @@ static int aic3x_probe(struct snd_soc_codec *codec) ...@@ -1414,7 +1414,7 @@ static int aic3x_probe(struct snd_soc_codec *codec)
&aic3x->disable_nb[i].nb); &aic3x->disable_nb[i].nb);
regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies); regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies);
err_get: err_get:
if (aic3x->gpio_reset >= 0) if (gpio_is_valid(aic3x->gpio_reset))
gpio_free(aic3x->gpio_reset); gpio_free(aic3x->gpio_reset);
err_gpio: err_gpio:
kfree(aic3x); kfree(aic3x);
...@@ -1427,7 +1427,7 @@ static int aic3x_remove(struct snd_soc_codec *codec) ...@@ -1427,7 +1427,7 @@ static int aic3x_remove(struct snd_soc_codec *codec)
int i; int i;
aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
if (aic3x->gpio_reset >= 0) { if (gpio_is_valid(aic3x->gpio_reset)) {
gpio_set_value(aic3x->gpio_reset, 0); gpio_set_value(aic3x->gpio_reset, 0);
gpio_free(aic3x->gpio_reset); gpio_free(aic3x->gpio_reset);
} }
......
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