LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: Use gpio_is_valid()
@ 2018-04-27  8:56 Arvind Yadav
  2018-04-27  8:56 ` [PATCH 1/3] ASoC: tlv320dac33: " Arvind Yadav
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Arvind Yadav @ 2018-04-27  8:56 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, jkosina; +Cc: linux-kernel, linux-input, alsa-devel

Replace the manual validity checks for the GPIO with the
gpio_is_valid().

Arvind Yadav (3):
  [PATCH 1/3] ASoC: tlv320dac33: Use gpio_is_valid()
  [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid()
  [PATCH 3/3] ASoC: samsung: Use gpio_is_valid()

 sound/soc/codecs/tlv320dac33.c     | 10 +++++-----
 sound/soc/codecs/tpa6130a2.c       |  8 ++++----
 sound/soc/samsung/s3c24xx_simtec.c | 10 +++++-----
 3 files changed, 14 insertions(+), 14 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] ASoC: tlv320dac33: Use gpio_is_valid()
  2018-04-27  8:56 [PATCH 0/3] ASoC: Use gpio_is_valid() Arvind Yadav
@ 2018-04-27  8:56 ` Arvind Yadav
  2018-04-27  9:33   ` [alsa-devel] " Peter Ujfalusi
  2018-04-27  8:56 ` [PATCH 2/3] ASoC: tpa6130a2: " Arvind Yadav
  2018-04-27  8:56 ` [PATCH 3/3] ASoC: samsung: " Arvind Yadav
  2 siblings, 1 reply; 7+ messages in thread
From: Arvind Yadav @ 2018-04-27  8:56 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, jkosina; +Cc: linux-kernel, linux-input, alsa-devel

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/tlv320dac33.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index a957eae..c23b9db 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -397,13 +397,13 @@ static int dac33_hard_power(struct snd_soc_component *component, int power)
 				goto exit;
 		}
 
-		if (dac33->power_gpio >= 0)
+		if (gpio_is_valid(dac33->power_gpio))
 			gpio_set_value(dac33->power_gpio, 1);
 
 		dac33->chip_power = 1;
 	} else {
 		dac33_soft_power(component, 0);
-		if (dac33->power_gpio >= 0)
+		if (gpio_is_valid(dac33->power_gpio))
 			gpio_set_value(dac33->power_gpio, 0);
 
 		ret = regulator_bulk_disable(ARRAY_SIZE(dac33->supplies),
@@ -1519,7 +1519,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
 	dac33->fifo_mode = DAC33_FIFO_BYPASS;
 
 	/* Check if the reset GPIO number is valid and request it */
-	if (dac33->power_gpio >= 0) {
+	if (gpio_is_valid(dac33->power_gpio)) {
 		ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset");
 		if (ret < 0) {
 			dev_err(&client->dev,
@@ -1548,7 +1548,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
 
 	return ret;
 err_get:
-	if (dac33->power_gpio >= 0)
+	if (gpio_is_valid(dac33->power_gpio))
 		gpio_free(dac33->power_gpio);
 err_gpio:
 	return ret;
@@ -1561,7 +1561,7 @@ static int dac33_i2c_remove(struct i2c_client *client)
 	if (unlikely(dac33->chip_power))
 		dac33_hard_power(dac33->component, 0);
 
-	if (dac33->power_gpio >= 0)
+	if (gpio_is_valid(dac33->power_gpio))
 		gpio_free(dac33->power_gpio);
 
 	return 0;
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid()
  2018-04-27  8:56 [PATCH 0/3] ASoC: Use gpio_is_valid() Arvind Yadav
  2018-04-27  8:56 ` [PATCH 1/3] ASoC: tlv320dac33: " Arvind Yadav
@ 2018-04-27  8:56 ` Arvind Yadav
  2018-04-27  9:33   ` [alsa-devel] " Peter Ujfalusi
  2018-04-27  8:56 ` [PATCH 3/3] ASoC: samsung: " Arvind Yadav
  2 siblings, 1 reply; 7+ messages in thread
From: Arvind Yadav @ 2018-04-27  8:56 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, jkosina; +Cc: linux-kernel, linux-input, alsa-devel

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(-)

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) {
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3] ASoC: samsung: Use gpio_is_valid()
  2018-04-27  8:56 [PATCH 0/3] ASoC: Use gpio_is_valid() Arvind Yadav
  2018-04-27  8:56 ` [PATCH 1/3] ASoC: tlv320dac33: " Arvind Yadav
  2018-04-27  8:56 ` [PATCH 2/3] ASoC: tpa6130a2: " Arvind Yadav
@ 2018-04-27  8:56 ` Arvind Yadav
       [not found]   ` <CGME20180427093444epcas2p185dbba85e2d37bde95ce3929a57c1f01@epcas2p1.samsung.com>
  2 siblings, 1 reply; 7+ messages in thread
From: Arvind Yadav @ 2018-04-27  8:56 UTC (permalink / raw)
  To: jikos, benjamin.tissoires, jkosina; +Cc: linux-kernel, linux-input, alsa-devel

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/samsung/s3c24xx_simtec.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c
index 6de63f3..23e8ef9d 100644
--- a/sound/soc/samsung/s3c24xx_simtec.c
+++ b/sound/soc/samsung/s3c24xx_simtec.c
@@ -229,7 +229,7 @@ static int attach_gpio_amp(struct device *dev,
 	int ret;
 
 	/* attach gpio amp gain (if any) */
-	if (pdata->amp_gain[0] > 0) {
+	if (gpio_is_valid(pdata->amp_gain[0])) {
 		ret = gpio_request(pd->amp_gain[0], "gpio-amp-gain0");
 		if (ret) {
 			dev_err(dev, "cannot get amp gpio gain0\n");
@@ -248,7 +248,7 @@ static int attach_gpio_amp(struct device *dev,
 	}
 
 	/* note, currently we assume GPA0 isn't valid amp */
-	if (pdata->amp_gpio > 0) {
+	if (gpio_is_valid(pdata->amp_gpio)) {
 		ret = gpio_request(pd->amp_gpio, "gpio-amp");
 		if (ret) {
 			dev_err(dev, "cannot get amp gpio %d (%d)\n",
@@ -263,7 +263,7 @@ static int attach_gpio_amp(struct device *dev,
 	return 0;
 
 err_amp:
-	if (pd->amp_gain[0] > 0) {
+	if (gpio_is_valid(pd->amp_gain[0])) {
 		gpio_free(pd->amp_gain[0]);
 		gpio_free(pd->amp_gain[1]);
 	}
@@ -273,12 +273,12 @@ static int attach_gpio_amp(struct device *dev,
 
 static void detach_gpio_amp(struct s3c24xx_audio_simtec_pdata *pd)
 {
-	if (pd->amp_gain[0] > 0) {
+	if (gpio_is_valid(pd->amp_gain[0])) {
 		gpio_free(pd->amp_gain[0]);
 		gpio_free(pd->amp_gain[1]);
 	}
 
-	if (pd->amp_gpio > 0)
+	if (gpio_is_valid(pd->amp_gpio))
 		gpio_free(pd->amp_gpio);
 }
 
-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [alsa-devel] [PATCH 1/3] ASoC: tlv320dac33: Use gpio_is_valid()
  2018-04-27  8:56 ` [PATCH 1/3] ASoC: tlv320dac33: " Arvind Yadav
@ 2018-04-27  9:33   ` Peter Ujfalusi
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2018-04-27  9:33 UTC (permalink / raw)
  To: Arvind Yadav, jikos, benjamin.tissoires, jkosina
  Cc: alsa-devel, linux-kernel, linux-input



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/tlv320dac33.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
> index a957eae..c23b9db 100644
> --- a/sound/soc/codecs/tlv320dac33.c
> +++ b/sound/soc/codecs/tlv320dac33.c
> @@ -397,13 +397,13 @@ static int dac33_hard_power(struct snd_soc_component *component, int power)
>  				goto exit;
>  		}
>  
> -		if (dac33->power_gpio >= 0)
> +		if (gpio_is_valid(dac33->power_gpio))
>  			gpio_set_value(dac33->power_gpio, 1);
>  
>  		dac33->chip_power = 1;
>  	} else {
>  		dac33_soft_power(component, 0);
> -		if (dac33->power_gpio >= 0)
> +		if (gpio_is_valid(dac33->power_gpio))
>  			gpio_set_value(dac33->power_gpio, 0);
>  
>  		ret = regulator_bulk_disable(ARRAY_SIZE(dac33->supplies),
> @@ -1519,7 +1519,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
>  	dac33->fifo_mode = DAC33_FIFO_BYPASS;
>  
>  	/* Check if the reset GPIO number is valid and request it */
> -	if (dac33->power_gpio >= 0) {
> +	if (gpio_is_valid(dac33->power_gpio)) {
>  		ret = gpio_request(dac33->power_gpio, "tlv320dac33 reset");
>  		if (ret < 0) {
>  			dev_err(&client->dev,
> @@ -1548,7 +1548,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
>  
>  	return ret;
>  err_get:
> -	if (dac33->power_gpio >= 0)
> +	if (gpio_is_valid(dac33->power_gpio))
>  		gpio_free(dac33->power_gpio);
>  err_gpio:
>  	return ret;
> @@ -1561,7 +1561,7 @@ static int dac33_i2c_remove(struct i2c_client *client)
>  	if (unlikely(dac33->chip_power))
>  		dac33_hard_power(dac33->component, 0);
>  
> -	if (dac33->power_gpio >= 0)
> +	if (gpio_is_valid(dac33->power_gpio))
>  		gpio_free(dac33->power_gpio);
>  
>  	return 0;
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [alsa-devel] [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid()
  2018-04-27  8:56 ` [PATCH 2/3] ASoC: tpa6130a2: " Arvind Yadav
@ 2018-04-27  9:33   ` Peter Ujfalusi
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2018-04-27  9:33 UTC (permalink / raw)
  To: Arvind Yadav, jikos, benjamin.tissoires, jkosina
  Cc: alsa-devel, linux-kernel, linux-input



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] ASoC: samsung: Use gpio_is_valid()
       [not found]   ` <CGME20180427093444epcas2p185dbba85e2d37bde95ce3929a57c1f01@epcas2p1.samsung.com>
@ 2018-04-27  9:34     ` Sylwester Nawrocki
  0 siblings, 0 replies; 7+ messages in thread
From: Sylwester Nawrocki @ 2018-04-27  9:34 UTC (permalink / raw)
  To: Arvind Yadav
  Cc: jikos, benjamin.tissoires, jkosina, linux-kernel, linux-input,
	alsa-devel

Hi Arvind,

On 04/27/2018 10:56 AM, Arvind Yadav wrote:
> Replace the manual validity checks for the GPIO with the
> gpio_is_valid().
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>

The patch looks good to me but you need to send it directly
to the ASoC maintainers to have it applied.

-- 
Regards,
Sylwester

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-04-27  9:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27  8:56 [PATCH 0/3] ASoC: Use gpio_is_valid() Arvind Yadav
2018-04-27  8:56 ` [PATCH 1/3] ASoC: tlv320dac33: " Arvind Yadav
2018-04-27  9:33   ` [alsa-devel] " Peter Ujfalusi
2018-04-27  8:56 ` [PATCH 2/3] ASoC: tpa6130a2: " Arvind Yadav
2018-04-27  9:33   ` [alsa-devel] " Peter Ujfalusi
2018-04-27  8:56 ` [PATCH 3/3] ASoC: samsung: " Arvind Yadav
     [not found]   ` <CGME20180427093444epcas2p185dbba85e2d37bde95ce3929a57c1f01@epcas2p1.samsung.com>
2018-04-27  9:34     ` Sylwester Nawrocki

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).