2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-16 17:43:56 +08:00

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
This commit is contained in:
Sam Ravnborg 2020-05-14 21:09:45 +02:00
parent 1efa9eff7b
commit a18dc7401a

View File

@ -299,7 +299,8 @@ put_node:
static int panel_probe(struct platform_device *pdev)
{
struct device_node *bl_node, *node = pdev->dev.of_node;
struct device_node *node = pdev->dev.of_node;
struct backlight_device *backlight;
struct panel_module *panel_mod;
struct tilcdc_module *mod;
struct pinctrl *pinctrl;
@ -315,16 +316,10 @@ static int panel_probe(struct platform_device *pdev)
if (!panel_mod)
return -ENOMEM;
bl_node = of_parse_phandle(node, "backlight", 0);
if (bl_node) {
panel_mod->backlight = of_find_backlight_by_node(bl_node);
of_node_put(bl_node);
if (!panel_mod->backlight)
return -EPROBE_DEFER;
dev_info(&pdev->dev, "found backlight\n");
}
backlight = devm_of_find_backlight(&pdev->dev);
if (IS_ERR(backlight))
return PTR_ERR(backlight);
panel_mod->backlight = backlight;
panel_mod->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
GPIOD_OUT_LOW);