Skip to content

Commit a18dc74

Browse files
committed
drm/tilcdc: use devm_of_find_backlight
Look up backlight device using devm_of_find_backlight(). This simplifies the code and prevents us from hardcoding the node name in the driver. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Jyri Sarha <jsarha@ti.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200514191001.457441-3-sam@ravnborg.org
1 parent 1efa9ef commit a18dc74

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎drivers/gpu/drm/tilcdc/tilcdc_panel.c‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ static struct tilcdc_panel_info *of_get_panel_info(struct device_node *np)
299299

300300
static int panel_probe(struct platform_device *pdev)
301301
{
302-
struct device_node *bl_node, *node = pdev->dev.of_node;
302+
struct device_node *node = pdev->dev.of_node;
303+
struct backlight_device *backlight;
303304
struct panel_module *panel_mod;
304305
struct tilcdc_module *mod;
305306
struct pinctrl *pinctrl;
@@ -315,16 +316,10 @@ static int panel_probe(struct platform_device *pdev)
315316
if (!panel_mod)
316317
return -ENOMEM;
317318

318-
bl_node = of_parse_phandle(node, "backlight", 0);
319-
if (bl_node) {
320-
panel_mod->backlight = of_find_backlight_by_node(bl_node);
321-
of_node_put(bl_node);
322-
323-
if (!panel_mod->backlight)
324-
return -EPROBE_DEFER;
325-
326-
dev_info(&pdev->dev, "found backlight\n");
327-
}
319+
backlight = devm_of_find_backlight(&pdev->dev);
320+
if (IS_ERR(backlight))
321+
return PTR_ERR(backlight);
322+
panel_mod->backlight = backlight;
328323

329324
panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
330325
GPIOD_OUT_LOW);

0 commit comments

Comments
 (0)