backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional
Subsystems (3)
PATCH 1/1 backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output.
Simplify the usage of devm_gpiod_get_optional accordingly.
--- drivers/video/backlight/pwm_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/video/backlight/pwm_bl.c +2 -4
@@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->dev = &pdev->dev; pb->enabled = false; - pb->enable_gpio =devm_gpiod_get_optional (&pdev->dev,"enable" ); + pb->enable_gpio =devm_gpiod_get_optional (&pdev->dev,"enable" , +GPIOD_OUT_HIGH );if (IS_ERR (pb->enable_gpio)) { ret =PTR_ERR (pb->enable_gpio); goto err_alloc;
@@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enable_gpio =gpio_to_desc (data->enable_gpio); } -if (pb->enable_gpio) -gpiod_direction_output (pb->enable_gpio,1 ); - pb->power_supply =devm_regulator_get (&pdev->dev,"power" );if (IS_ERR (pb->power_supply)) { ret =PTR_ERR (pb->power_supply);
Signature · 1 line
2.1.0
Lee Jones
AppliedQuoted 9 lines · Axel Lin
Since
39b2bbe3d715(gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output.
Simplify the usage ofdevm_gpiod_get_optionalaccordingly.Signed-off-by Axel Lin <[email protected]>--- drivers/video/backlight/pwm_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Applied, thanks.
Quoted 24 lines
drivers/video/backlight/pwm_bl.c +2
-4@@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->dev = &pdev->dev; pb->enabled = false; - pb->enable_gpio =devm_gpiod_get_optional (&pdev->dev,"enable" ); + pb->enable_gpio =devm_gpiod_get_optional (&pdev->dev,"enable" , +GPIOD_OUT_HIGH );if (IS_ERR (pb->enable_gpio)) { ret =PTR_ERR (pb->enable_gpio); goto err_alloc;@@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enable_gpio =gpio_to_desc (data->enable_gpio); } -if (pb->enable_gpio) -gpiod_direction_output (pb->enable_gpio,1 ); - pb->power_supply =devm_regulator_get (&pdev->dev,"power" );if (IS_ERR (pb->power_supply)) { ret =PTR_ERR (pb->power_supply);
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Hello,
Quoted 6 lines · Axel Lin
Since
39b2bbe3d715(gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output.
Simplify the usage ofdevm_gpiod_get_optionalaccordingly.Signed-off-by Axel Lin <[email protected]>
as I just sent the same patch:
@Axel: Do you have some more patches of this type in the queue? I currently have several fixes on top of 4.1-rc4. Some of them are still in a single wip patch, some other are already sent out.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
2015-05-19 15:59 GMT+08:00 Uwe Kleine-König <[email protected]>:
Quoted 8 lines
Hello,
Quoted 5 lines · Axel Lin
Since
39b2bbe3d715(gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output.
Simplify the usage ofdevm_gpiod_get_optionalaccordingly.
Quoted 6 lines
Quoted 1 line
Signed-off-by Axel Lin <[email protected]>as I just sent the same patch:
Acked-by Uwe Kleine-König <[email protected]>@Axel: Do you have some more patches of this type in the queue? I
No, I don't have other patches of this type in the queue.
Regards,
Axel