Commit 9cace32f authored by Liviu Dudau's avatar Liviu Dudau Committed by Daniel Vetter

drm/imx: Convert the probe function to the generic drm_of_component_probe()

The generic function is functionally equivalent to the driver's
imx_drm_platform_probe(). Use the generic function and reduce the
overall code size.
Signed-off-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
Acked-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1445332995-11212-3-git-send-email-Liviu.Dudau@arm.comSigned-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent df785aa8
...@@ -531,59 +531,12 @@ static const struct component_master_ops imx_drm_ops = { ...@@ -531,59 +531,12 @@ static const struct component_master_ops imx_drm_ops = {
static int imx_drm_platform_probe(struct platform_device *pdev) static int imx_drm_platform_probe(struct platform_device *pdev)
{ {
struct device_node *ep, *port, *remote; int ret = drm_of_component_probe(&pdev->dev, compare_of, &imx_drm_ops);
struct component_match *match = NULL;
int ret;
int i;
/*
* Bind the IPU display interface ports first, so that
* imx_drm_encoder_parse_of called from encoder .bind callbacks
* works as expected.
*/
for (i = 0; ; i++) {
port = of_parse_phandle(pdev->dev.of_node, "ports", i);
if (!port)
break;
component_match_add(&pdev->dev, &match, compare_of, port);
}
if (i == 0) { if (!ret)
dev_err(&pdev->dev, "missing 'ports' property\n"); ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
return -ENODEV;
}
/* Then bind all encoders */ return ret;
for (i = 0; ; i++) {
port = of_parse_phandle(pdev->dev.of_node, "ports", i);
if (!port)
break;
for_each_child_of_node(port, ep) {
remote = of_graph_get_remote_port_parent(ep);
if (!remote || !of_device_is_available(remote)) {
of_node_put(remote);
continue;
} else if (!of_device_is_available(remote->parent)) {
dev_warn(&pdev->dev, "parent device of %s is not available\n",
remote->full_name);
of_node_put(remote);
continue;
}
component_match_add(&pdev->dev, &match, compare_of,
remote);
of_node_put(remote);
}
of_node_put(port);
}
ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
return component_master_add_with_match(&pdev->dev, &imx_drm_ops, match);
} }
static int imx_drm_platform_remove(struct platform_device *pdev) static int imx_drm_platform_remove(struct platform_device *pdev)
......
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