Skip to content

Commit

Permalink
drm/bridge: analogix_dp: Fix connector and encoder cleanup
Browse files Browse the repository at this point in the history
Since we are initing connector in the core driver and encoder in the
plat driver, let's clean them up in the right places.

Signed-off-by: Jeffy Chen <[email protected]>
Signed-off-by: Thierry Escande <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]>
Signed-off-by: Heiko Stuebner <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
JeffyCN authored and mmind committed Mar 1, 2018
1 parent 6b2d8fd commit 7fe201c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,6 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
ret = analogix_dp_create_bridge(drm_dev, dp);
if (ret) {
DRM_ERROR("failed to create bridge (%d)\n", ret);
drm_encoder_cleanup(dp->encoder);
goto err_disable_pm_runtime;
}

Expand All @@ -1430,7 +1429,6 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
{
analogix_dp_bridge_disable(dp->bridge);
dp->connector.funcs->destroy(&dp->connector);
dp->encoder->funcs->destroy(dp->encoder);

if (dp->plat_data->panel) {
if (drm_panel_unprepare(dp->plat_data->panel))
Expand Down
7 changes: 5 additions & 2 deletions drivers/gpu/drm/exynos/exynos_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,10 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
dp->plat_data.encoder = encoder;

dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
if (IS_ERR(dp->adp))
if (IS_ERR(dp->adp)) {
dp->encoder.funcs->destroy(&dp->encoder);
return PTR_ERR(dp->adp);
}

return 0;
}
Expand All @@ -196,7 +198,8 @@ static void exynos_dp_unbind(struct device *dev, struct device *master,
{
struct exynos_dp_device *dp = dev_get_drvdata(dev);

return analogix_dp_unbind(dp->adp);
analogix_dp_unbind(dp->adp);
dp->encoder.funcs->destroy(&dp->encoder);
}

static const struct component_ops exynos_dp_ops = {
Expand Down
12 changes: 5 additions & 7 deletions drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,13 +259,8 @@ static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
.atomic_check = rockchip_dp_drm_encoder_atomic_check,
};

static void rockchip_dp_drm_encoder_destroy(struct drm_encoder *encoder)
{
drm_encoder_cleanup(encoder);
}

static struct drm_encoder_funcs rockchip_dp_encoder_funcs = {
.destroy = rockchip_dp_drm_encoder_destroy,
.destroy = drm_encoder_cleanup,
};

static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
Expand Down Expand Up @@ -362,8 +357,10 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set);

dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
if (IS_ERR(dp->adp))
if (IS_ERR(dp->adp)) {
dp->encoder.funcs->destroy(&dp->encoder);
return PTR_ERR(dp->adp);
}

return 0;
}
Expand All @@ -375,6 +372,7 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master,

rockchip_drm_psr_unregister(&dp->encoder);
analogix_dp_unbind(dp->adp);
dp->encoder.funcs->destroy(&dp->encoder);
}

static const struct component_ops rockchip_dp_component_ops = {
Expand Down

0 comments on commit 7fe201c

Please sign in to comment.