[PATCH 4.17 045/324] drm/arm/malidp: Ensure that the crtcs are shutdown before removing any encoder/connector

From: Greg Kroah-Hartman
Date: Thu Aug 23 2018 - 04:42:49 EST

4.17-stable review patch. If anyone has any objections, please let me know.


From: Ayan Kumar Halder <ayan.halder@xxxxxxx>

[ Upstream commit 109c4d18e57445afcaf728b8716a69375a3daab2 ]

One needs to ensure that the crtcs are shutdown so that the
drm_crtc_state->connector_mask reflects that no connectors
are currently active. Further, it reduces the reference
count for each connector. This ensures that the connectors
and encoders can be cleanly removed either when _unbind
is called for the corresponding drivers or by
We need drm_atomic_helper_shutdown() to be called before
component_unbind_all() otherwise the connectors attached to the
component device will have the wrong reference count value and will not
be cleanly removed.

Signed-off-by: Ayan Kumar Halder <ayan.halder@xxxxxxx>
Acked-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Liviu Dudau <liviu.dudau@xxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
drivers/gpu/drm/arm/malidp_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -278,7 +278,6 @@ static int malidp_init(struct drm_device

static void malidp_fini(struct drm_device *drm)
- drm_atomic_helper_shutdown(drm);

@@ -646,6 +645,7 @@ vblank_fail:
drm->irq_enabled = false;
+ drm_atomic_helper_shutdown(drm);
component_unbind_all(dev, drm);
@@ -681,6 +681,7 @@ static void malidp_unbind(struct device
drm->irq_enabled = false;
+ drm_atomic_helper_shutdown(drm);
component_unbind_all(dev, drm);
malidp->crtc.port = NULL;