Commit 08de7afa authored by benjamin.gaignard@linaro.org's avatar benjamin.gaignard@linaro.org Committed by Benjamin Gaignard

drm/stm: ltdc: remove bridge from driver internal structure

With a call to drm_of_panel_bridge_remove() we could remove the bridge
without store it in ldtc internal driver structure.
Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: default avatarPhilippe Cornu <philippe.cornu@st.com>
Tested-by: default avatarPhilippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506936888-23844-4-git-send-email-benjamin.gaignard@linaro.org
parent c70087e8
...@@ -791,9 +791,8 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = { ...@@ -791,9 +791,8 @@ static const struct drm_encoder_funcs ltdc_encoder_funcs = {
.destroy = drm_encoder_cleanup, .destroy = drm_encoder_cleanup,
}; };
static int ltdc_encoder_init(struct drm_device *ddev) static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
{ {
struct ltdc_device *ldev = ddev->dev_private;
struct drm_encoder *encoder; struct drm_encoder *encoder;
int ret; int ret;
...@@ -807,7 +806,7 @@ static int ltdc_encoder_init(struct drm_device *ddev) ...@@ -807,7 +806,7 @@ static int ltdc_encoder_init(struct drm_device *ddev)
drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs, drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs,
DRM_MODE_ENCODER_DPI, NULL); DRM_MODE_ENCODER_DPI, NULL);
ret = drm_bridge_attach(encoder, ldev->bridge, NULL); ret = drm_bridge_attach(encoder, bridge, NULL);
if (ret) { if (ret) {
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
return -EINVAL; return -EINVAL;
...@@ -936,12 +935,9 @@ int ltdc_load(struct drm_device *ddev) ...@@ -936,12 +935,9 @@ int ltdc_load(struct drm_device *ddev)
ret = PTR_ERR(bridge); ret = PTR_ERR(bridge);
goto err; goto err;
} }
ldev->is_panel_bridge = true;
} }
ldev->bridge = bridge; ret = ltdc_encoder_init(ddev, bridge);
ret = ltdc_encoder_init(ddev);
if (ret) { if (ret) {
DRM_ERROR("Failed to init encoder\n"); DRM_ERROR("Failed to init encoder\n");
goto err; goto err;
...@@ -972,8 +968,7 @@ int ltdc_load(struct drm_device *ddev) ...@@ -972,8 +968,7 @@ int ltdc_load(struct drm_device *ddev)
return 0; return 0;
err: err:
if (ldev->is_panel_bridge) drm_panel_bridge_remove(bridge);
drm_panel_bridge_remove(bridge);
clk_disable_unprepare(ldev->pixel_clk); clk_disable_unprepare(ldev->pixel_clk);
...@@ -986,8 +981,7 @@ void ltdc_unload(struct drm_device *ddev) ...@@ -986,8 +981,7 @@ void ltdc_unload(struct drm_device *ddev)
DRM_DEBUG_DRIVER("\n"); DRM_DEBUG_DRIVER("\n");
if (ldev->is_panel_bridge) drm_of_panel_bridge_remove(ddev->dev->of_node, 0, 0);
drm_panel_bridge_remove(ldev->bridge);
clk_disable_unprepare(ldev->pixel_clk); clk_disable_unprepare(ldev->pixel_clk);
} }
......
...@@ -24,8 +24,6 @@ struct ltdc_device { ...@@ -24,8 +24,6 @@ struct ltdc_device {
struct drm_fbdev_cma *fbdev; struct drm_fbdev_cma *fbdev;
void __iomem *regs; void __iomem *regs;
struct clk *pixel_clk; /* lcd pixel clock */ struct clk *pixel_clk; /* lcd pixel clock */
struct drm_bridge *bridge;
bool is_panel_bridge;
struct mutex err_lock; /* protecting error_status */ struct mutex err_lock; /* protecting error_status */
struct ltdc_caps caps; struct ltdc_caps caps;
u32 error_status; u32 error_status;
......
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