diff mbox

[4/8] drm/sti: fix atomic_disable check

Message ID 1473946905-4374-5-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabien DESSENNE Sept. 15, 2016, 1:41 p.m. UTC
When a drm_plane is being disabled, its ->crtc member is set to NULL
before the .atomic_disable() func is called.
To get the crtc of the plane, read old_state->crtc instead of
drm_plane->crtc

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/gpu/drm/sti/sti_cursor.c | 6 +++---
 drivers/gpu/drm/sti/sti_gdp.c    | 6 +++---
 drivers/gpu/drm/sti/sti_hqvdp.c  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

Comments

Vincent Abriou Sept. 15, 2016, 3:28 p.m. UTC | #1
Acked-by: Vincent Abriou <vincent.abriou@st.com>


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> When a drm_plane is being disabled, its ->crtc member is set to NULL
> before the .atomic_disable() func is called.
> To get the crtc of the plane, read old_state->crtc instead of
> drm_plane->crtc
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/gpu/drm/sti/sti_cursor.c | 6 +++---
>  drivers/gpu/drm/sti/sti_gdp.c    | 6 +++---
>  drivers/gpu/drm/sti/sti_hqvdp.c  | 6 +++---
>  3 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
> index 3b53f7f..3a8b656 100644
> --- a/drivers/gpu/drm/sti/sti_cursor.c
> +++ b/drivers/gpu/drm/sti/sti_cursor.c
> @@ -309,15 +309,15 @@ static void sti_cursor_atomic_disable(struct drm_plane *drm_plane,
>  {
>  	struct sti_plane *plane = to_sti_plane(drm_plane);
>
> -	if (!drm_plane->crtc) {
> +	if (!oldstate->crtc) {
>  		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>  				 drm_plane->base.id);
>  		return;
>  	}
>
>  	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -			 drm_plane->crtc->base.id,
> -			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +			 oldstate->crtc->base.id,
> +			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>  			 drm_plane->base.id, sti_plane_to_str(plane));
>
>  	plane->status = STI_PLANE_DISABLING;
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 19052c4..d5f7b18 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -858,15 +858,15 @@ static void sti_gdp_atomic_disable(struct drm_plane *drm_plane,
>  	/* restore possible crtcs value with the initial value */
>  	drm_plane->possible_crtcs = plane->init_possible_crtcs;
>
> -	if (!drm_plane->crtc) {
> +	if (!oldstate->crtc) {
>  		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>  				 drm_plane->base.id);
>  		return;
>  	}
>
>  	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -			 drm_plane->crtc->base.id,
> -			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +			 oldstate->crtc->base.id,
> +			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>  			 drm_plane->base.id, sti_plane_to_str(plane));
>
>  	plane->status = STI_PLANE_DISABLING;
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index a222b2e..9dd13fd 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1214,15 +1214,15 @@ static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane,
>  {
>  	struct sti_plane *plane = to_sti_plane(drm_plane);
>
> -	if (!drm_plane->crtc) {
> +	if (!oldstate->crtc) {
>  		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
>  				 drm_plane->base.id);
>  		return;
>  	}
>
>  	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
> -			 drm_plane->crtc->base.id,
> -			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
> +			 oldstate->crtc->base.id,
> +			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
>  			 drm_plane->base.id, sti_plane_to_str(plane));
>
>  	plane->status = STI_PLANE_DISABLING;
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 3b53f7f..3a8b656 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -309,15 +309,15 @@  static void sti_cursor_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 19052c4..d5f7b18 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -858,15 +858,15 @@  static void sti_gdp_atomic_disable(struct drm_plane *drm_plane,
 	/* restore possible crtcs value with the initial value */
 	drm_plane->possible_crtcs = plane->init_possible_crtcs;
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index a222b2e..9dd13fd 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1214,15 +1214,15 @@  static void sti_hqvdp_atomic_disable(struct drm_plane *drm_plane,
 {
 	struct sti_plane *plane = to_sti_plane(drm_plane);
 
-	if (!drm_plane->crtc) {
+	if (!oldstate->crtc) {
 		DRM_DEBUG_DRIVER("drm plane:%d not enabled\n",
 				 drm_plane->base.id);
 		return;
 	}
 
 	DRM_DEBUG_DRIVER("CRTC:%d (%s) drm plane:%d (%s)\n",
-			 drm_plane->crtc->base.id,
-			 sti_mixer_to_str(to_sti_mixer(drm_plane->crtc)),
+			 oldstate->crtc->base.id,
+			 sti_mixer_to_str(to_sti_mixer(oldstate->crtc)),
 			 drm_plane->base.id, sti_plane_to_str(plane));
 
 	plane->status = STI_PLANE_DISABLING;