[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <195792a282b569037357ca17e4baad19893f0609.1524819052.git.arvind.yadav.cs@gmail.com>
Date: Fri, 27 Apr 2018 14:26:10 +0530
From: Arvind Yadav <arvind.yadav.cs@...il.com>
To: jikos@...nel.org, benjamin.tissoires@...hat.com, jkosina@...e.cz
Cc: linux-kernel@...r.kernel.org, linux-input@...r.kernel.org,
alsa-devel@...a-project.org
Subject: [PATCH 2/3] ASoC: tpa6130a2: Use gpio_is_valid()
Replace the manual validity checks for the GPIO with the
gpio_is_valid().
Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.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
Powered by blists - more mailing lists