backlight: pwm-backlight: Use devm_gpiod_get_optional()
authorAlexandre Courbot <acourbot@nvidia.com>
Wed, 25 Jun 2014 09:18:18 +0000 (18:18 +0900)
committerLee Jones <lee.jones@linaro.org>
Fri, 18 Jul 2014 07:40:06 +0000 (08:40 +0100)
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>
drivers/video/backlight/pwm_bl.c

index c9c8496..d7a3d13 100644 (file)
@@ -239,13 +239,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;
        }
 
        /*