drm/omapdrm: Use of_find_backlight helper
Replace of_find_backlight_by_node and of the code around it with of_find_backlight helper to avoid repetition of code. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Meghana Madhyastha <meghana.madhyastha@gmail.com> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/eb914313f9d0e58d81572ccd3c718a573a891bd7.1516810726.git.meghana.madhyastha@gmail.com
This commit is contained in:
parent
c69f94570d
commit
2b91e3c43b
@ -157,7 +157,6 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
struct panel_drv_data *ddata = platform_get_drvdata(pdev);
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
struct device_node *bl_node;
|
|
||||||
struct omap_dss_device *in;
|
struct omap_dss_device *in;
|
||||||
int r;
|
int r;
|
||||||
struct display_timing timing;
|
struct display_timing timing;
|
||||||
@ -183,19 +182,15 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
|
|||||||
if (IS_ERR(ddata->vcc_supply))
|
if (IS_ERR(ddata->vcc_supply))
|
||||||
return PTR_ERR(ddata->vcc_supply);
|
return PTR_ERR(ddata->vcc_supply);
|
||||||
|
|
||||||
bl_node = of_parse_phandle(node, "backlight", 0);
|
ddata->backlight = devm_of_find_backlight(&pdev->dev);
|
||||||
if (bl_node) {
|
|
||||||
ddata->backlight = of_find_backlight_by_node(bl_node);
|
|
||||||
of_node_put(bl_node);
|
|
||||||
|
|
||||||
if (!ddata->backlight)
|
if (IS_ERR(ddata->backlight))
|
||||||
return -EPROBE_DEFER;
|
return PTR_ERR(ddata->backlight);
|
||||||
}
|
|
||||||
|
|
||||||
r = of_get_display_timing(node, "panel-timing", &timing);
|
r = of_get_display_timing(node, "panel-timing", &timing);
|
||||||
if (r) {
|
if (r) {
|
||||||
dev_err(&pdev->dev, "failed to get video timing\n");
|
dev_err(&pdev->dev, "failed to get video timing\n");
|
||||||
goto error_free_backlight;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
videomode_from_timing(&timing, &ddata->vm);
|
videomode_from_timing(&timing, &ddata->vm);
|
||||||
@ -203,19 +198,12 @@ static int panel_dpi_probe_of(struct platform_device *pdev)
|
|||||||
in = omapdss_of_find_source_for_first_ep(node);
|
in = omapdss_of_find_source_for_first_ep(node);
|
||||||
if (IS_ERR(in)) {
|
if (IS_ERR(in)) {
|
||||||
dev_err(&pdev->dev, "failed to find video source\n");
|
dev_err(&pdev->dev, "failed to find video source\n");
|
||||||
r = PTR_ERR(in);
|
return PTR_ERR(in);
|
||||||
goto error_free_backlight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ddata->in = in;
|
ddata->in = in;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error_free_backlight:
|
|
||||||
if (ddata->backlight)
|
|
||||||
put_device(&ddata->backlight->dev);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int panel_dpi_probe(struct platform_device *pdev)
|
static int panel_dpi_probe(struct platform_device *pdev)
|
||||||
@ -270,9 +258,6 @@ static int __exit panel_dpi_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
omap_dss_put_device(in);
|
omap_dss_put_device(in);
|
||||||
|
|
||||||
if (ddata->backlight)
|
|
||||||
put_device(&ddata->backlight->dev);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user