Re: [alsa-devel] [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid()

From: Peter Ujfalusi
Date: Fri Apr 27 2018 - 05:33:35 EST




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@xxxxxx>

> Signed-off-by: Arvind Yadav <arvind.yadav.cs@xxxxxxxxx>
> ---
> 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