All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm-backlight: use devm_gpiod_get_optional()
@ 2014-06-25  9:18 ` Alexandre Courbot
  0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Courbot @ 2014-06-25  9:18 UTC (permalink / raw)
  To: Thierry Reding, Jingoo Han, Bryan Wu, Lee Jones
  Cc: linux-fbdev, linux-kernel, gnurou, Alexandre Courbot

Make use of the new devm_gpiod_get_optional() to simplify the probe
code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 38ca88bc5c3e..d1e0a7c6cac7 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -245,13 +245,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	pb->dev = &pdev->dev;
 	pb->enabled = false;
 
-	pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable");
+	pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable");
 	if (IS_ERR(pb->enable_gpio)) {
 		ret = PTR_ERR(pb->enable_gpio);
-		if (ret == -ENOENT)
-			pb->enable_gpio = NULL;
-		else
-			goto err_alloc;
+		goto err_alloc;
 	}
 
 	/*
-- 
2.0.0


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

end of thread, other threads:[~2014-06-27  6:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25  9:18 [PATCH] pwm-backlight: use devm_gpiod_get_optional() Alexandre Courbot
2014-06-25  9:18 ` Alexandre Courbot
2014-06-25  9:54 ` Lee Jones
2014-06-25  9:54   ` Lee Jones
2014-06-25 11:13   ` Thierry Reding
2014-06-25 11:13     ` Thierry Reding
2014-06-25 12:03     ` Lee Jones
2014-06-25 12:03       ` Lee Jones
2014-06-27  6:13       ` Thierry Reding
2014-06-27  6:13         ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.