Commit 0caddbbf authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: dpi: Switch to devm_drm_of_get_bridge

The new devm_drm_of_get_bridge removes most of the boilerplate we
have to deal with. Let's switch to it.
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210910130941.1740182-3-maxime@cerno.tech
parent 87ea9580
...@@ -229,26 +229,19 @@ static const struct of_device_id vc4_dpi_dt_match[] = { ...@@ -229,26 +229,19 @@ static const struct of_device_id vc4_dpi_dt_match[] = {
static int vc4_dpi_init_bridge(struct vc4_dpi *dpi) static int vc4_dpi_init_bridge(struct vc4_dpi *dpi)
{ {
struct device *dev = &dpi->pdev->dev; struct device *dev = &dpi->pdev->dev;
struct drm_panel *panel;
struct drm_bridge *bridge; struct drm_bridge *bridge;
int ret;
ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
&panel, &bridge); if (IS_ERR(bridge)) {
if (ret) {
/* If nothing was connected in the DT, that's not an /* If nothing was connected in the DT, that's not an
* error. * error.
*/ */
if (ret == -ENODEV) if (PTR_ERR(bridge) == -ENODEV)
return 0; return 0;
else else
return ret; return PTR_ERR(bridge);
} }
if (panel)
bridge = drm_panel_bridge_add_typed(panel,
DRM_MODE_CONNECTOR_DPI);
return drm_bridge_attach(dpi->encoder, bridge, NULL, 0); return drm_bridge_attach(dpi->encoder, bridge, NULL, 0);
} }
......
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