Now a panel_bridge is automatically created for every drm_panel, so this code (similar to an open-coded variant of drm_of_find_panel_or_bridge()) would lead to creating a second bridge for the same panel.
Update and simplify the code by just getting a reference to the already-existing bridge. Signed-off-by: Luca Ceresoli <[email protected]> --- drivers/gpu/drm/omapdrm/dss/omapdss.h | 1 - drivers/gpu/drm/omapdrm/dss/output.c | 42 ++++------------------------------- 2 files changed, 4 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 4c22c09c93d5..e3e685c931f1 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -204,7 +204,6 @@ struct omap_dss_device { struct dss_device *dss; struct drm_bridge *bridge; struct drm_bridge *next_bridge; - struct drm_panel *panel; struct list_head list; diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index 6e9bc605ee22..36d37deac802 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -12,7 +12,6 @@ #include <linux/of_graph.h> #include <drm/drm_bridge.h> -#include <drm/drm_panel.h> #include "dss.h" #include "omapdss.h" @@ -20,40 +19,16 @@ int omapdss_device_init_output(struct omap_dss_device *out, struct drm_bridge *local_bridge) { - struct device_node *remote_node; + struct drm_bridge *bridge; int ret; - remote_node = of_graph_get_remote_node(out->dev->of_node, - out->of_port, 0); - if (!remote_node) { + bridge = of_drm_get_bridge_by_endpoint(out->dev->of_node, out->of_port, 0); + if (IS_ERR(bridge)) { dev_dbg(out->dev, "failed to find video sink\n"); return 0; } - out->panel = of_drm_find_panel(remote_node); - if (IS_ERR(out->panel)) - out->panel = NULL; - - if (!out->panel) - out->bridge = of_drm_find_and_get_bridge(remote_node); - - of_node_put(remote_node); - - if (out->panel) { - struct drm_bridge *bridge; - - bridge = drm_panel_bridge_add(out->panel); - drm_panel_put(out->panel); - if (IS_ERR(bridge)) { - dev_err(out->dev, - "unable to create panel bridge (%ld)\n", - PTR_ERR(bridge)); - ret = PTR_ERR(bridge); - goto error; - } - - out->bridge = drm_bridge_get(bridge); - } + out->bridge = bridge; if (local_bridge) { if (!out->bridge) { @@ -65,11 +40,6 @@ int omapdss_device_init_output(struct omap_dss_device *out, out->bridge = drm_bridge_get(local_bridge); } - if (!out->bridge) { - ret = -EPROBE_DEFER; - goto error; - } - return 0; error: @@ -79,10 +49,6 @@ int omapdss_device_init_output(struct omap_dss_device *out, void omapdss_device_cleanup_output(struct omap_dss_device *out) { - if (out->bridge && out->panel) - drm_panel_bridge_remove(out->next_bridge ? - out->next_bridge : out->bridge); - drm_bridge_put(out->next_bridge); drm_bridge_put(out->bridge); } -- 2.55.0
