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
@@ -341,7 +341,7 @@ static void mdp4_lcdc_encoder_disable(struct drm_encoder *encoder)
|
||||
mdp4_write(mdp4_kms, REG_MDP4_LCDC_ENABLE, 0);
|
||||
|
||||
panel = of_drm_find_panel(mdp4_lcdc_encoder->panel_node);
|
||||
if (panel) {
|
||||
if (!IS_ERR(panel)) {
|
||||
drm_panel_disable(panel);
|
||||
drm_panel_unprepare(panel);
|
||||
}
|
||||
@@ -410,7 +410,7 @@ static void mdp4_lcdc_encoder_enable(struct drm_encoder *encoder)
|
||||
dev_err(dev->dev, "failed to enable lcdc_clk: %d\n", ret);
|
||||
|
||||
panel = of_drm_find_panel(mdp4_lcdc_encoder->panel_node);
|
||||
if (panel) {
|
||||
if (!IS_ERR(panel)) {
|
||||
drm_panel_prepare(panel);
|
||||
drm_panel_enable(panel);
|
||||
}
|
||||
|
@@ -34,9 +34,12 @@ static enum drm_connector_status mdp4_lvds_connector_detect(
|
||||
struct mdp4_lvds_connector *mdp4_lvds_connector =
|
||||
to_mdp4_lvds_connector(connector);
|
||||
|
||||
if (!mdp4_lvds_connector->panel)
|
||||
if (!mdp4_lvds_connector->panel) {
|
||||
mdp4_lvds_connector->panel =
|
||||
of_drm_find_panel(mdp4_lvds_connector->panel_node);
|
||||
if (IS_ERR(mdp4_lvds_connector->panel))
|
||||
mdp4_lvds_connector->panel = NULL;
|
||||
}
|
||||
|
||||
return mdp4_lvds_connector->panel ?
|
||||
connector_status_connected :
|
||||
|
@@ -1898,7 +1898,7 @@ int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer)
|
||||
* output
|
||||
*/
|
||||
if (check_defer && msm_host->device_node) {
|
||||
if (!of_drm_find_panel(msm_host->device_node))
|
||||
if (IS_ERR(of_drm_find_panel(msm_host->device_node)))
|
||||
if (!of_drm_find_bridge(msm_host->device_node))
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
Reference in New Issue
Block a user