drm/panel: Make of_drm_find_panel() return an ERR_PTR() instead of NULL
Right now, the DRM panel logic returns NULL when a panel pointing to the passed OF node is not present in the list of registered panels. Most drivers interpret this NULL value as -EPROBE_DEFER, but we are about to modify the semantic of of_drm_find_panel() and let the framework return -ENODEV when the device node we're pointing to has a status property that is not equal to "okay" or "ok". Let's first patch the of_drm_find_panel() implementation to return ERR_PTR(-EPROBE_DEFER) instead of NULL and patch all callers to replace the '!panel' check by an 'IS_ERR(panel)' one. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180509130042.9435-2-boris.brezillon@bootlin.com
This commit is contained in:

committed by
Thierry Reding

parent
0ca0c827ef
commit
5fa8e4a221
@@ -232,9 +232,11 @@ static int exynos_dp_probe(struct platform_device *pdev)
|
||||
np = of_parse_phandle(dev->of_node, "panel", 0);
|
||||
if (np) {
|
||||
dp->plat_data.panel = of_drm_find_panel(np);
|
||||
|
||||
of_node_put(np);
|
||||
if (!dp->plat_data.panel)
|
||||
return -EPROBE_DEFER;
|
||||
if (IS_ERR(dp->plat_data.panel))
|
||||
return PTR_ERR(dp->plat_data.panel);
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@@ -240,8 +240,8 @@ struct drm_encoder *exynos_dpi_probe(struct device *dev)
|
||||
|
||||
if (ctx->panel_node) {
|
||||
ctx->panel = of_drm_find_panel(ctx->panel_node);
|
||||
if (!ctx->panel)
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
if (IS_ERR(ctx->panel))
|
||||
return ERR_CAST(ctx->panel);
|
||||
}
|
||||
|
||||
return &ctx->encoder;
|
||||
|
@@ -1519,6 +1519,9 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
|
||||
dsi->format = device->format;
|
||||
dsi->mode_flags = device->mode_flags;
|
||||
dsi->panel = of_drm_find_panel(device->dev.of_node);
|
||||
if (IS_ERR(dsi->panel))
|
||||
dsi->panel = NULL;
|
||||
|
||||
if (dsi->panel) {
|
||||
drm_panel_attach(dsi->panel, &dsi->connector);
|
||||
dsi->connector.status = connector_status_connected;
|
||||
|
Reference in New Issue
Block a user