From: Alexandre Courbot Date: Fri, 25 Jul 2014 14:47:25 +0000 (+0900) Subject: drm/panel: simple: Use devm_gpiod_get_optional() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9746c61960b63d2cea41333bca00c60f032052bb;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drm/panel: simple: Use devm_gpiod_get_optional() Use the new devm_gpiod_get_optional() to simplify the probe code. Signed-off-by: Alexandre Courbot Signed-off-by: Thierry Reding --- diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index 6ae1aada6373..4ce1db0a68ff 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -247,16 +247,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) if (IS_ERR(panel->supply)) return PTR_ERR(panel->supply); - panel->enable_gpio = devm_gpiod_get(dev, "enable"); + panel->enable_gpio = devm_gpiod_get_optional(dev, "enable"); if (IS_ERR(panel->enable_gpio)) { err = PTR_ERR(panel->enable_gpio); - if (err != -ENOENT) { - dev_err(dev, "failed to request GPIO: %d\n", err); - return err; - } + dev_err(dev, "failed to request GPIO: %d\n", err); + return err; + } - panel->enable_gpio = NULL; - } else { + if (panel->enable_gpio) { err = gpiod_direction_output(panel->enable_gpio, 0); if (err < 0) { dev_err(dev, "failed to setup GPIO: %d\n", err);