Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cdaefcce authored by Axel Lin's avatar Axel Lin Committed by Lee Jones
Browse files

backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional



Since 39b2bbe3 (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.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 61c1c614
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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);