Skip to contentSkip to conversation

ASoC: pxa2xx-ac97: Use devm_gpiod_get_optional()

PATCH Superseded Andy Shevchenko 1 participant 2 messages Mar 2 – Mar 18

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: pxa2xx-ac97: Use devm_gpiod_get_optional()

No need to open code the devm_gpiod_get_optional() wrapper. Instead of checking for a certain error code, check for NULL.

---

v2: added tag (Peng), rebased on top of latest ASoC tree

 sound/arm/pxa2xx-ac97-lib.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
sound/arm/pxa2xx-ac97-lib.c +4 -5
index 1e114dbcf93c..47889f6003c1 100644
@@ -330,13 +330,12 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
 
 	if (dev->dev.of_node) {
 		/* Assert reset using GPIOD_OUT_HIGH, because reset is GPIO_ACTIVE_LOW */
-		rst_gpio = devm_gpiod_get(&dev->dev, "reset", GPIOD_OUT_HIGH);
+		rst_gpio = devm_gpiod_get_optional(&dev->dev, "reset", GPIOD_OUT_HIGH);
 		ret = PTR_ERR(rst_gpio);
-		if (ret == -ENOENT)
-			reset_gpio = -1;
-		else if (ret)
+		if (ret)
 			return ret;
-		reset_gpio = desc_to_gpio(rst_gpio);
+
+		reset_gpio = rst_gpio ? desc_to_gpio(rst_gpio) : -1;
 	} else {
 		if (cpu_is_pxa27x())
 			reset_gpio = 113;
Signature · 1 line
2.50.1
#1 lore raw
Quoted 2 lines · Andy Shevchenko

No need to open code the devm_gpiod_get_optional() wrapper. Instead of checking for a certain error code, check for NULL.

Are we waiting for anybody from PXA to look into this? I believe it will take too much time... (based on my experience with PXA related patches).

Signature · 2 lines
With Best Regards,
Andy Shevchenko