diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2020-05-14 22:09:45 +0300 |
---|---|---|
committer | Sam Ravnborg <sam@ravnborg.org> | 2020-05-17 15:55:29 +0300 |
commit | a18dc7401ab5c86de38f64ee6301a6bd3757f017 (patch) | |
tree | ce9ac1703c7da56a6cf49728bb4d1122888719eb /drivers/gpu/drm/tilcdc | |
parent | 1efa9eff7b94ed834162a17091db2fedc656763b (diff) | |
download | linux-a18dc7401ab5c86de38f64ee6301a6bd3757f017.tar.xz |
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
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_panel.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 12823d60c4e8..b207b2f19d42 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -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); |