Commit 9746c619 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Thierry Reding

drm/panel: simple: Use devm_gpiod_get_optional()

Use the new devm_gpiod_get_optional() to simplify the probe code.
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 77df01dc
...@@ -247,16 +247,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc) ...@@ -247,16 +247,14 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
if (IS_ERR(panel->supply)) if (IS_ERR(panel->supply))
return PTR_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)) { if (IS_ERR(panel->enable_gpio)) {
err = PTR_ERR(panel->enable_gpio); err = PTR_ERR(panel->enable_gpio);
if (err != -ENOENT) { dev_err(dev, "failed to request GPIO: %d\n", err);
dev_err(dev, "failed to request GPIO: %d\n", err); return err;
return err; }
}
panel->enable_gpio = NULL; if (panel->enable_gpio) {
} else {
err = gpiod_direction_output(panel->enable_gpio, 0); err = gpiod_direction_output(panel->enable_gpio, 0);
if (err < 0) { if (err < 0) {
dev_err(dev, "failed to setup GPIO: %d\n", err); dev_err(dev, "failed to setup GPIO: %d\n", err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment