diff mbox

[10/13] drm/atmel-hlcdc: Stop using plane->fb

Message ID 20180405151400.11326-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä April 5, 2018, 3:13 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We want to get rid of plane->fb on atomic drivers. Stop looking at it.

Daniel pointed out that the drm_framebuffer_put() in the plane cleanup
indicates that the driver doesn't shut things down cleanly. To do
that we should be able to just call drm_atomic_helper_shutdown(). Not
really sure the current cleanup sequence is actually sane, but whatever.

v2: Replace the drm_framebuffer_put() with
    drm_atomic_helper_shutdown() (Daniel)

Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    |  1 +
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
 2 files changed, 2 insertions(+), 11 deletions(-)

Comments

Daniel Vetter April 5, 2018, 4:38 p.m. UTC | #1
On Thu, Apr 05, 2018 at 06:13:57PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We want to get rid of plane->fb on atomic drivers. Stop looking at it.
> 
> Daniel pointed out that the drm_framebuffer_put() in the plane cleanup
> indicates that the driver doesn't shut things down cleanly. To do
> that we should be able to just call drm_atomic_helper_shutdown(). Not
> really sure the current cleanup sequence is actually sane, but whatever.
> 
> v2: Replace the drm_framebuffer_put() with
>     drm_atomic_helper_shutdown() (Daniel)
> 
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c    |  1 +
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 12 +-----------
>  2 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index c1ea5c36b006..843cac222e60 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -681,6 +681,7 @@ static void atmel_hlcdc_dc_unload(struct drm_device *dev)
>  	drm_fb_cma_fbdev_fini(dev);
>  	flush_workqueue(dc->wq);
>  	drm_kms_helper_poll_fini(dev);
> +	drm_atomic_helper_shutdown(dev);

Yeah, looks like the right place for this.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  	drm_mode_config_cleanup(dev);
>  
>  	pm_runtime_get_sync(dev->dev);
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 9271c2fa3d79..8ecf02db8d01 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> @@ -820,16 +820,6 @@ static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
>  	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
>  }
>  
> -static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
> -{
> -	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
> -
> -	if (plane->base.fb)
> -		drm_framebuffer_put(plane->base.fb);
> -
> -	drm_plane_cleanup(p);
> -}
> -
>  static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
>  						 struct drm_plane_state *s,
>  						 struct drm_property *property,
> @@ -1039,7 +1029,7 @@ static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
>  static const struct drm_plane_funcs layer_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> -	.destroy = atmel_hlcdc_plane_destroy,
> +	.destroy = drm_plane_cleanup,
>  	.reset = atmel_hlcdc_plane_reset,
>  	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,
> -- 
> 2.16.1
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index c1ea5c36b006..843cac222e60 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -681,6 +681,7 @@  static void atmel_hlcdc_dc_unload(struct drm_device *dev)
 	drm_fb_cma_fbdev_fini(dev);
 	flush_workqueue(dc->wq);
 	drm_kms_helper_poll_fini(dev);
+	drm_atomic_helper_shutdown(dev);
 	drm_mode_config_cleanup(dev);
 
 	pm_runtime_get_sync(dev->dev);
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 9271c2fa3d79..8ecf02db8d01 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -820,16 +820,6 @@  static void atmel_hlcdc_plane_atomic_disable(struct drm_plane *p,
 	atmel_hlcdc_layer_read_reg(&plane->layer, ATMEL_HLCDC_LAYER_ISR);
 }
 
-static void atmel_hlcdc_plane_destroy(struct drm_plane *p)
-{
-	struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p);
-
-	if (plane->base.fb)
-		drm_framebuffer_put(plane->base.fb);
-
-	drm_plane_cleanup(p);
-}
-
 static int atmel_hlcdc_plane_atomic_set_property(struct drm_plane *p,
 						 struct drm_plane_state *s,
 						 struct drm_property *property,
@@ -1039,7 +1029,7 @@  static void atmel_hlcdc_plane_atomic_destroy_state(struct drm_plane *p,
 static const struct drm_plane_funcs layer_plane_funcs = {
 	.update_plane = drm_atomic_helper_update_plane,
 	.disable_plane = drm_atomic_helper_disable_plane,
-	.destroy = atmel_hlcdc_plane_destroy,
+	.destroy = drm_plane_cleanup,
 	.reset = atmel_hlcdc_plane_reset,
 	.atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state,
 	.atomic_destroy_state = atmel_hlcdc_plane_atomic_destroy_state,