[15/21] drm/omap: Nuke close hooks
diff mbox

Message ID 1452285413-28459-16-git-send-email-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Jan. 8, 2016, 8:36 p.m. UTC
Again since the core takes care of this we can remove them. While at
it also remove the postclose hook, it's empty.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

Comments

Laurent Pinchart Jan. 11, 2016, 12:03 a.m. UTC | #1
Hi Daniel,

Thank you for the patch.

On Friday 08 January 2016 21:36:47 Daniel Vetter wrote:
> Again since the core takes care of this we can remove them. While at
> it also remove the postclose hook, it's empty.
>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 29 -----------------------------
>  1 file changed, 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c
> b/drivers/gpu/drm/omapdrm/omap_drv.c index dfafdb602ad2..e8b5080f6e2d
> 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -787,33 +787,6 @@ static void dev_lastclose(struct drm_device *dev)
>  	}
>  }
> 
> -static void dev_preclose(struct drm_device *dev, struct drm_file *file)
> -{
> -	struct omap_drm_private *priv = dev->dev_private;
> -	struct drm_pending_event *event;
> -	unsigned long flags;
> -
> -	DBG("preclose: dev=%p", dev);
> -
> -	/*
> -	 * Unlink all pending CRTC events to make sure they won't be queued up
> -	 * by a pending asynchronous commit.
> -	 */
> -	spin_lock_irqsave(&dev->event_lock, flags);
> -	list_for_each_entry(event, &priv->commit.events, link) {
> -		if (event->file_priv == file) {
> -			file->event_space += event->event->length;
> -			event->file_priv = NULL;
> -		}
> -	}
> -	spin_unlock_irqrestore(&dev->event_lock, flags);
> -}
> -
> -static void dev_postclose(struct drm_device *dev, struct drm_file *file)
> -{
> -	DBG("postclose: dev=%p, file=%p", dev, file);
> -}
> -

You can also nuke the following code from omap_atomic_commit():

        /* Keep track of all CRTC events to unlink them in preclose(). */
        spin_lock_irqsave(&dev->event_lock, flags);
        for (i = 0; i < dev->mode_config.num_crtc; ++i) {
                struct drm_crtc_state *cstate = state->crtc_states[i];

                if (cstate && cstate->event)
                        list_add_tail(&cstate->event->base.link,
                                      &priv->commit.events);
        }
        spin_unlock_irqrestore(&dev->event_lock, flags);

and the priv->commit.events field in omap_drv.h (don't forget the structure 
kerneldoc).

>  static const struct vm_operations_struct omap_gem_vm_ops = {
>  	.fault = omap_gem_fault,
>  	.open = drm_gem_vm_open,
> @@ -838,8 +811,6 @@ static struct drm_driver omap_drm_driver = {
>  	.unload = dev_unload,
>  	.open = dev_open,
>  	.lastclose = dev_lastclose,
> -	.preclose = dev_preclose,
> -	.postclose = dev_postclose,
>  	.set_busid = drm_platform_set_busid,
>  	.get_vblank_counter = drm_vblank_no_hw_counter,
>  	.enable_vblank = omap_irq_enable_vblank,
Daniel Vetter Jan. 11, 2016, 7:10 a.m. UTC | #2
On Mon, Jan 11, 2016 at 02:03:34AM +0200, Laurent Pinchart wrote:
> Hi Daniel,
> 
> Thank you for the patch.
> 
> On Friday 08 January 2016 21:36:47 Daniel Vetter wrote:
> > Again since the core takes care of this we can remove them. While at
> > it also remove the postclose hook, it's empty.
> >
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/omapdrm/omap_drv.c | 29 -----------------------------
> >  1 file changed, 29 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c
> > b/drivers/gpu/drm/omapdrm/omap_drv.c index dfafdb602ad2..e8b5080f6e2d
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> > @@ -787,33 +787,6 @@ static void dev_lastclose(struct drm_device *dev)
> >  	}
> >  }
> > 
> > -static void dev_preclose(struct drm_device *dev, struct drm_file *file)
> > -{
> > -	struct omap_drm_private *priv = dev->dev_private;
> > -	struct drm_pending_event *event;
> > -	unsigned long flags;
> > -
> > -	DBG("preclose: dev=%p", dev);
> > -
> > -	/*
> > -	 * Unlink all pending CRTC events to make sure they won't be queued up
> > -	 * by a pending asynchronous commit.
> > -	 */
> > -	spin_lock_irqsave(&dev->event_lock, flags);
> > -	list_for_each_entry(event, &priv->commit.events, link) {
> > -		if (event->file_priv == file) {
> > -			file->event_space += event->event->length;
> > -			event->file_priv = NULL;
> > -		}
> > -	}
> > -	spin_unlock_irqrestore(&dev->event_lock, flags);
> > -}
> > -
> > -static void dev_postclose(struct drm_device *dev, struct drm_file *file)
> > -{
> > -	DBG("postclose: dev=%p, file=%p", dev, file);
> > -}
> > -
> 
> You can also nuke the following code from omap_atomic_commit():
> 
>         /* Keep track of all CRTC events to unlink them in preclose(). */
>         spin_lock_irqsave(&dev->event_lock, flags);
>         for (i = 0; i < dev->mode_config.num_crtc; ++i) {
>                 struct drm_crtc_state *cstate = state->crtc_states[i];
> 
>                 if (cstate && cstate->event)
>                         list_add_tail(&cstate->event->base.link,
>                                       &priv->commit.events);
>         }
>         spin_unlock_irqrestore(&dev->event_lock, flags);
> 
> and the priv->commit.events field in omap_drv.h (don't forget the structure 
> kerneldoc).

Oh this is really good, since hunting for related code I noticed that omap
doesn't send out the vblank event when the fpriv disappeared. So found
even more code to remove. I didn't find any kerneldoc though.
-Daniel

> 
> >  static const struct vm_operations_struct omap_gem_vm_ops = {
> >  	.fault = omap_gem_fault,
> >  	.open = drm_gem_vm_open,
> > @@ -838,8 +811,6 @@ static struct drm_driver omap_drm_driver = {
> >  	.unload = dev_unload,
> >  	.open = dev_open,
> >  	.lastclose = dev_lastclose,
> > -	.preclose = dev_preclose,
> > -	.postclose = dev_postclose,
> >  	.set_busid = drm_platform_set_busid,
> >  	.get_vblank_counter = drm_vblank_no_hw_counter,
> >  	.enable_vblank = omap_irq_enable_vblank,
> 
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index dfafdb602ad2..e8b5080f6e2d 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -787,33 +787,6 @@  static void dev_lastclose(struct drm_device *dev)
 	}
 }
 
-static void dev_preclose(struct drm_device *dev, struct drm_file *file)
-{
-	struct omap_drm_private *priv = dev->dev_private;
-	struct drm_pending_event *event;
-	unsigned long flags;
-
-	DBG("preclose: dev=%p", dev);
-
-	/*
-	 * Unlink all pending CRTC events to make sure they won't be queued up
-	 * by a pending asynchronous commit.
-	 */
-	spin_lock_irqsave(&dev->event_lock, flags);
-	list_for_each_entry(event, &priv->commit.events, link) {
-		if (event->file_priv == file) {
-			file->event_space += event->event->length;
-			event->file_priv = NULL;
-		}
-	}
-	spin_unlock_irqrestore(&dev->event_lock, flags);
-}
-
-static void dev_postclose(struct drm_device *dev, struct drm_file *file)
-{
-	DBG("postclose: dev=%p, file=%p", dev, file);
-}
-
 static const struct vm_operations_struct omap_gem_vm_ops = {
 	.fault = omap_gem_fault,
 	.open = drm_gem_vm_open,
@@ -838,8 +811,6 @@  static struct drm_driver omap_drm_driver = {
 	.unload = dev_unload,
 	.open = dev_open,
 	.lastclose = dev_lastclose,
-	.preclose = dev_preclose,
-	.postclose = dev_postclose,
 	.set_busid = drm_platform_set_busid,
 	.get_vblank_counter = drm_vblank_no_hw_counter,
 	.enable_vblank = omap_irq_enable_vblank,