diff mbox

[2/3] ASoC: tpa6130a2: Use gpio_is_valid()

Message ID 195792a282b569037357ca17e4baad19893f0609.1524819052.git.arvind.yadav.cs@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arvind Yadav April 27, 2018, 8:56 a.m. UTC
Replace the manual validity checks for the GPIO with the
gpio_is_valid().

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 sound/soc/codecs/tpa6130a2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Peter Ujfalusi April 27, 2018, 9:33 a.m. UTC | #1
On 2018-04-27 11:56, Arvind Yadav wrote:
> Replace the manual validity checks for the GPIO with the
> gpio_is_valid().

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  sound/soc/codecs/tpa6130a2.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index 616cd4b..18f32b9 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -62,7 +62,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
>  			return ret;
>  		}
>  		/* Power on */
> -		if (data->power_gpio >= 0)
> +		if (gpio_is_valid(data->power_gpio))
>  			gpio_set_value(data->power_gpio, 1);
>  
>  		/* Sync registers */
> @@ -72,7 +72,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
>  			dev_err(data->dev,
>  				"Failed to sync registers: %d\n", ret);
>  			regcache_cache_only(data->regmap, true);
> -			if (data->power_gpio >= 0)
> +			if (gpio_is_valid(data->power_gpio))
>  				gpio_set_value(data->power_gpio, 0);
>  			ret2 = regulator_disable(data->supply);
>  			if (ret2 != 0)
> @@ -89,7 +89,7 @@ static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
>  		regcache_cache_only(data->regmap, true);
>  
>  		/* Power off */
> -		if (data->power_gpio >= 0)
> +		if (gpio_is_valid(data->power_gpio))
>  			gpio_set_value(data->power_gpio, 0);
>  
>  		ret = regulator_disable(data->supply);
> @@ -259,7 +259,7 @@ static int tpa6130a2_probe(struct i2c_client *client,
>  
>  	data->id = id->driver_data;
>  
> -	if (data->power_gpio >= 0) {
> +	if (gpio_is_valid(data->power_gpio)) {
>  		ret = devm_gpio_request(dev, data->power_gpio,
>  					"tpa6130a2 enable");
>  		if (ret < 0) {
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 616cd4b..18f32b9 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -62,7 +62,7 @@  static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
 			return ret;
 		}
 		/* Power on */
-		if (data->power_gpio >= 0)
+		if (gpio_is_valid(data->power_gpio))
 			gpio_set_value(data->power_gpio, 1);
 
 		/* Sync registers */
@@ -72,7 +72,7 @@  static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
 			dev_err(data->dev,
 				"Failed to sync registers: %d\n", ret);
 			regcache_cache_only(data->regmap, true);
-			if (data->power_gpio >= 0)
+			if (gpio_is_valid(data->power_gpio))
 				gpio_set_value(data->power_gpio, 0);
 			ret2 = regulator_disable(data->supply);
 			if (ret2 != 0)
@@ -89,7 +89,7 @@  static int tpa6130a2_power(struct tpa6130a2_data *data, bool enable)
 		regcache_cache_only(data->regmap, true);
 
 		/* Power off */
-		if (data->power_gpio >= 0)
+		if (gpio_is_valid(data->power_gpio))
 			gpio_set_value(data->power_gpio, 0);
 
 		ret = regulator_disable(data->supply);
@@ -259,7 +259,7 @@  static int tpa6130a2_probe(struct i2c_client *client,
 
 	data->id = id->driver_data;
 
-	if (data->power_gpio >= 0) {
+	if (gpio_is_valid(data->power_gpio)) {
 		ret = devm_gpio_request(dev, data->power_gpio,
 					"tpa6130a2 enable");
 		if (ret < 0) {