mirror of
https://github.com/torvalds/linux.git
synced 2024-12-28 05:41:55 +00:00
backlight: pwm-backlight: Use devm_gpiod_get_optional()
Make use of the new devm_gpiod_get_optional() to simplify the probe code. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
1e3b097012
commit
ff9c5422d8
@ -239,13 +239,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
|
|||||||
pb->dev = &pdev->dev;
|
pb->dev = &pdev->dev;
|
||||||
pb->enabled = false;
|
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)) {
|
if (IS_ERR(pb->enable_gpio)) {
|
||||||
ret = PTR_ERR(pb->enable_gpio);
|
ret = PTR_ERR(pb->enable_gpio);
|
||||||
if (ret == -ENOENT)
|
goto err_alloc;
|
||||||
pb->enable_gpio = NULL;
|
|
||||||
else
|
|
||||||
goto err_alloc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user