Skip to contentSkip to conversation

ASoC: tas2552: Use devm_gpiod_get_optional for enable-gpio

PATCH Applied Axel Lin 3 participants 3 messages Jun 10, 2015 – Jun 11, 2015

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: tas2552: Use devm_gpiod_get_optional for enable-gpio

commit ea178d1456dc ("ASoC: tas2552: Make the enable-gpio really optional") makes enable-gpio optional. devm_gpiod_get_optional() is the better function for optional gpio, so let's switch to use it.

---
 sound/soc/codecs/tas2552.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/codecs/tas2552.c +4 -7
index 169a703..4f25a7d 100644
@@ -703,13 +703,10 @@ static int tas2552_probe(struct i2c_client *client,
 	if (data == NULL)
 		return -ENOMEM;
 
-	data->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
-	if (IS_ERR(data->enable_gpio)) {
-		if (PTR_ERR(data->enable_gpio) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		data->enable_gpio = NULL;
-	}
+	data->enable_gpio = devm_gpiod_get_optional(dev, "enable",
+						    GPIOD_OUT_LOW);
+	if (IS_ERR(data->enable_gpio))
+		return PTR_ERR(data->enable_gpio);
 
 	data->tas2552_client = client;
 	data->regmap = devm_regmap_init_i2c(client, &tas2552_regmap_config);
Signature · 1 line
2.1.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Axel Lin

commit ea178d1456dc ("ASoC: tas2552: Make the enable-gpio really optional") makes enable-gpio optional. devm_gpiod_get_optional() is the better function for optional gpio, so let's switch to use it.

Quoted 27 lines
---
 sound/soc/codecs/tas2552.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
sound/soc/codecs/tas2552.c +4 -7
index 169a703..4f25a7d 100644
@@ -703,13 +703,10 @@ static int tas2552_probe(struct i2c_client *client,
 	if (data == NULL)
 		return -ENOMEM;
 
-	data->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
-	if (IS_ERR(data->enable_gpio)) {
-		if (PTR_ERR(data->enable_gpio) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		data->enable_gpio = NULL;
-	}
+	data->enable_gpio = devm_gpiod_get_optional(dev, "enable",
+						    GPIOD_OUT_LOW);
+	if (IS_ERR(data->enable_gpio))
+		return PTR_ERR(data->enable_gpio);
 
 	data->tas2552_client = client;
 	data->regmap = devm_regmap_init_i2c(client, &tas2552_regmap_config);
Signature · 5 lines
Péter
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer Applied
#2 lore raw
In reply to Axel Lin
Quoted 3 lines · Axel Lin

commit ea178d1456dc ("ASoC: tas2552: Make the enable-gpio really optional") makes enable-gpio optional. devm_gpiod_get_optional() is the better function for optional gpio, so let's switch to use it.

Applied, thanks.