Commit 61a72d5e authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Rob Clark

drm/msm/dp: switch to devm_drm_bridge_add()

Make MSM DP driver use devm_drm_bridge_add() instead of plain
drm_bridge_add(). As the driver doesn't require any additional cleanup,
stop adding created bridge to the priv->bridges array.
Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/561639/Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent b8ec1e7f
...@@ -1532,7 +1532,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp) ...@@ -1532,7 +1532,6 @@ static int dp_display_get_next_bridge(struct msm_dp *dp)
int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
struct msm_drm_private *priv = dev->dev_private;
struct dp_display_private *dp_priv; struct dp_display_private *dp_priv;
int ret; int ret;
...@@ -1550,17 +1549,13 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, ...@@ -1550,17 +1549,13 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
if (ret) if (ret)
return ret; return ret;
dp_display->bridge = dp_bridge_init(dp_display, dev, encoder); ret = dp_bridge_init(dp_display, dev, encoder);
if (IS_ERR(dp_display->bridge)) { if (ret) {
ret = PTR_ERR(dp_display->bridge);
DRM_DEV_ERROR(dev->dev, DRM_DEV_ERROR(dev->dev,
"failed to create dp bridge: %d\n", ret); "failed to create dp bridge: %d\n", ret);
dp_display->bridge = NULL;
return ret; return ret;
} }
priv->bridges[priv->num_bridges++] = dp_display->bridge;
dp_display->connector = dp_drm_connector_init(dp_display, encoder); dp_display->connector = dp_drm_connector_init(dp_display, encoder);
if (IS_ERR(dp_display->connector)) { if (IS_ERR(dp_display->connector)) {
ret = PTR_ERR(dp_display->connector); ret = PTR_ERR(dp_display->connector);
......
...@@ -272,7 +272,7 @@ static const struct drm_bridge_funcs edp_bridge_ops = { ...@@ -272,7 +272,7 @@ static const struct drm_bridge_funcs edp_bridge_ops = {
.atomic_check = edp_bridge_atomic_check, .atomic_check = edp_bridge_atomic_check,
}; };
struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, int dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev,
struct drm_encoder *encoder) struct drm_encoder *encoder)
{ {
int rc; int rc;
...@@ -281,7 +281,7 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * ...@@ -281,7 +281,7 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
dp_bridge = devm_kzalloc(dev->dev, sizeof(*dp_bridge), GFP_KERNEL); dp_bridge = devm_kzalloc(dev->dev, sizeof(*dp_bridge), GFP_KERNEL);
if (!dp_bridge) if (!dp_bridge)
return ERR_PTR(-ENOMEM); return -ENOMEM;
dp_bridge->dp_display = dp_display; dp_bridge->dp_display = dp_display;
...@@ -307,14 +307,18 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * ...@@ -307,14 +307,18 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
DRM_BRIDGE_OP_MODES; DRM_BRIDGE_OP_MODES;
} }
drm_bridge_add(bridge); rc = devm_drm_bridge_add(&dp_display->pdev->dev, bridge);
if (rc) {
DRM_ERROR("failed to add bridge, rc=%d\n", rc);
return rc;
}
rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR); rc = drm_bridge_attach(encoder, bridge, NULL, DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (rc) { if (rc) {
DRM_ERROR("failed to attach bridge, rc=%d\n", rc); DRM_ERROR("failed to attach bridge, rc=%d\n", rc);
drm_bridge_remove(bridge);
return ERR_PTR(rc); return rc;
} }
if (dp_display->next_bridge) { if (dp_display->next_bridge) {
...@@ -323,12 +327,13 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device * ...@@ -323,12 +327,13 @@ struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *
DRM_BRIDGE_ATTACH_NO_CONNECTOR); DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (rc < 0) { if (rc < 0) {
DRM_ERROR("failed to attach panel bridge: %d\n", rc); DRM_ERROR("failed to attach panel bridge: %d\n", rc);
drm_bridge_remove(bridge); return rc;
return ERR_PTR(rc);
} }
} }
return bridge; dp_display->bridge = bridge;
return 0;
} }
/* connector initialization */ /* connector initialization */
......
...@@ -20,7 +20,7 @@ struct msm_dp_bridge { ...@@ -20,7 +20,7 @@ struct msm_dp_bridge {
#define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge) #define to_dp_bridge(x) container_of((x), struct msm_dp_bridge, bridge)
struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder); struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display, struct drm_encoder *encoder);
struct drm_bridge *dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev, int dp_bridge_init(struct msm_dp *dp_display, struct drm_device *dev,
struct drm_encoder *encoder); struct drm_encoder *encoder);
void dp_bridge_atomic_enable(struct drm_bridge *drm_bridge, void dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
......
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