Skip to contentSkip to conversation

pwm-backlight: use devm_gpiod_get_optional()

PATCH In review Alexandre Courbot 3 participants 5 messages Jun 25, 2014 – Jun 27, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm-backlight: use devm_gpiod_get_optional()

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

---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/video/backlight/pwm_bl.c +2 -5
index 38ca88bc5c3e..d1e0a7c6cac7 100644
@@ -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;
 	}
 
 	/*
Signature · 1 line
2.0.0
#1 lore raw
Quoted 7 lines

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

---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Looks good. Applied, thanks.

Quoted 20 lines
drivers/video/backlight/pwm_bl.c +2 -5
index 38ca88bc5c3e..d1e0a7c6cac7 100644
@@ -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;
 	}
 
 	/*
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw
Quoted 9 lines · Lee Jones
Quoted 7 lines

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

---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Looks good. Applied, thanks.

Technically pwm_bl.c is my turf. However I only adopted it way back when the backlight subsystem was orphaned, but it seems Jingoo, Bryan and you are taking good care of it these days, so perhaps it would be a good idea to move it back to your custody?

Thierry

#3 lore raw
Quoted 9 lines · Thierry Reding
Quoted 8 lines · Lee Jones
Quoted 7 lines

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

---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Quoted 6 lines
Quoted 1 line

Looks good. Applied, thanks.

Technically pwm_bl.c is my turf. However I only adopted it way back when the backlight subsystem was orphaned, but it seems Jingoo, Bryan and you are taking good care of it these days, so perhaps it would be a good idea to move it back to your custody?

Yeah, the whole 'driver maintainer' sketch could get pretty complex. It's pretty clean-cut in the PWM subsystem as only one exists, but Backlight and MFD have a whole bunch, and I don't usually wait for them to Ack/Nack before applying or providing review comments.

I'm happy to play it however you like really. I'm sure the boys and I can handle it if you so wish. Even better if you would say in the MAINTAINERS file and provide review comments when patches are submitted. I do think all 'drivers/video/backlight' changes should go in via the Backlight tree though.

Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw
Quoted 22 lines · Lee Jones
Quoted 9 lines · Thierry Reding
Quoted 8 lines · Lee Jones
Quoted 7 lines

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

---
 drivers/video/backlight/pwm_bl.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Quoted 6 lines
Quoted 1 line

Looks good. Applied, thanks.

Technically pwm_bl.c is my turf. However I only adopted it way back when the backlight subsystem was orphaned, but it seems Jingoo, Bryan and you are taking good care of it these days, so perhaps it would be a good idea to move it back to your custody?

Yeah, the whole 'driver maintainer' sketch could get pretty complex. It's pretty clean-cut in the PWM subsystem as only one exists, but Backlight and MFD have a whole bunch, and I don't usually wait for them to Ack/Nack before applying or providing review comments.

Quoted 5 lines

I'm happy to play it however you like really. I'm sure the boys and I can handle it if you so wish. Even better if you would say in the MAINTAINERS file and provide review comments when patches are submitted. I do think all 'drivers/video/backlight' changes should go in via the Backlight tree though.

Okay, that works for me.

Thierry