diff mbox series

[05/17] drm/mali: Convert to using __drm_atomic_helper_crtc_reset() for reset.

Message ID 20190301125627.7285-6-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Start subclassing crtc_state. | expand

Commit Message

Maarten Lankhorst March 1, 2019, 12:56 p.m. UTC
Convert mali to using __drm_atomic_helper_crtc_reset(), instead of
writing its own version. Instead of open coding
malidp_crtc_destroy_state(), call it directly for freeing the old state.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
---
 drivers/gpu/drm/arm/malidp_crtc.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

Comments

Liviu Dudau March 1, 2019, 1:37 p.m. UTC | #1
Hi Maarten,

On Fri, Mar 01, 2019 at 01:56:15PM +0100, Maarten Lankhorst wrote:
> Convert mali to using __drm_atomic_helper_crtc_reset(), instead of
> writing its own version. Instead of open coding
> malidp_crtc_destroy_state(), call it directly for freeing the old state.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Liviu Dudau <liviu.dudau@arm.com>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

If you need me to take this patch into malidp tree let me know,
otherwise I expect is going to show up in drm-misc-next at some moment.

Best regards,
Liviu

> Cc: Brian Starkey <brian.starkey@arm.com>
> ---
>  drivers/gpu/drm/arm/malidp_crtc.c | 28 +++++++++++-----------------
>  1 file changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
> index 56aad288666e..d6690e016f0b 100644
> --- a/drivers/gpu/drm/arm/malidp_crtc.c
> +++ b/drivers/gpu/drm/arm/malidp_crtc.c
> @@ -463,23 +463,6 @@ static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc)
>  	return &state->base;
>  }
>  
> -static void malidp_crtc_reset(struct drm_crtc *crtc)
> -{
> -	struct malidp_crtc_state *state = NULL;
> -
> -	if (crtc->state) {
> -		state = to_malidp_crtc_state(crtc->state);
> -		__drm_atomic_helper_crtc_destroy_state(crtc->state);
> -	}
> -
> -	kfree(state);
> -	state = kzalloc(sizeof(*state), GFP_KERNEL);
> -	if (state) {
> -		crtc->state = &state->base;
> -		crtc->state->crtc = crtc;
> -	}
> -}
> -
>  static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
>  				      struct drm_crtc_state *state)
>  {
> @@ -493,6 +476,17 @@ static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
>  	kfree(mali_state);
>  }
>  
> +static void malidp_crtc_reset(struct drm_crtc *crtc)
> +{
> +	struct malidp_crtc_state *state =
> +		kzalloc(sizeof(*state), GFP_KERNEL);
> +
> +	if (crtc->state)
> +		malidp_crtc_destroy_state(crtc, crtc->state);
> +
> +	__drm_atomic_helper_crtc_reset(crtc, &state->base);
> +}
> +
>  static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
>  {
>  	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
index 56aad288666e..d6690e016f0b 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -463,23 +463,6 @@  static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc)
 	return &state->base;
 }
 
-static void malidp_crtc_reset(struct drm_crtc *crtc)
-{
-	struct malidp_crtc_state *state = NULL;
-
-	if (crtc->state) {
-		state = to_malidp_crtc_state(crtc->state);
-		__drm_atomic_helper_crtc_destroy_state(crtc->state);
-	}
-
-	kfree(state);
-	state = kzalloc(sizeof(*state), GFP_KERNEL);
-	if (state) {
-		crtc->state = &state->base;
-		crtc->state->crtc = crtc;
-	}
-}
-
 static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
 				      struct drm_crtc_state *state)
 {
@@ -493,6 +476,17 @@  static void malidp_crtc_destroy_state(struct drm_crtc *crtc,
 	kfree(mali_state);
 }
 
+static void malidp_crtc_reset(struct drm_crtc *crtc)
+{
+	struct malidp_crtc_state *state =
+		kzalloc(sizeof(*state), GFP_KERNEL);
+
+	if (crtc->state)
+		malidp_crtc_destroy_state(crtc, crtc->state);
+
+	__drm_atomic_helper_crtc_reset(crtc, &state->base);
+}
+
 static int malidp_crtc_enable_vblank(struct drm_crtc *crtc)
 {
 	struct malidp_drm *malidp = crtc_to_malidp_device(crtc);