drm/vmwgfx: Nuke preclose hook
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 25 Jan 2016 21:16:56 +0000 (22:16 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 8 Feb 2016 08:55:53 +0000 (09:55 +0100)
Again since the drm core takes care of event unlinking/disarming this
is now just needless code.

v2: I've completely missed eaction->fpriv_head and all the related
code. We need to nuke that too to avoid accidentally deferencing the
freed-up vmwgfx-private fpriv.

v3: Also remove vmw_fpriv->fence_events and unused variables I missed.

Cc: Thomas Hellström <thellstrom@vmware.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-23-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
drivers/gpu/drm/vmwgfx/vmwgfx_fence.h

index c49812b80dd0dae82c77096f75fbd4cced19ffb1..c96a2d2d510777e4668d1fc1802654c7e66638dd 100644 (file)
@@ -971,15 +971,6 @@ static int vmw_driver_unload(struct drm_device *dev)
        return 0;
 }
 
-static void vmw_preclose(struct drm_device *dev,
-                        struct drm_file *file_priv)
-{
-       struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
-       struct vmw_private *dev_priv = vmw_priv(dev);
-
-       vmw_event_fence_fpriv_gone(dev_priv->fman, &vmw_fp->fence_events);
-}
-
 static void vmw_postclose(struct drm_device *dev,
                         struct drm_file *file_priv)
 {
@@ -1010,7 +1001,6 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv)
        if (unlikely(vmw_fp == NULL))
                return ret;
 
-       INIT_LIST_HEAD(&vmw_fp->fence_events);
        vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10);
        if (unlikely(vmw_fp->tfile == NULL))
                goto out_no_tfile;
@@ -1500,7 +1490,6 @@ static struct drm_driver driver = {
        .master_set = vmw_master_set,
        .master_drop = vmw_master_drop,
        .open = vmw_driver_open,
-       .preclose = vmw_preclose,
        .postclose = vmw_postclose,
        .set_busid = drm_pci_set_busid,
 
index 469cdd520615d036fdb99b0f7e27ed67ce3abd67..5cb1b1687cd4c6f9be863ca3c757eabd74d91775 100644 (file)
@@ -80,7 +80,6 @@
 struct vmw_fpriv {
        struct drm_master *locked_master;
        struct ttm_object_file *tfile;
-       struct list_head fence_events;
        bool gb_aware;
 };
 
index 37c305b626081d82314f64a711de749c278b31e7..e959df6ede83e0a7b3b72e3c16df313f4df98940 100644 (file)
@@ -71,7 +71,6 @@ struct vmw_user_fence {
  */
 struct vmw_event_fence_action {
        struct vmw_fence_action action;
-       struct list_head fpriv_head;
 
        struct drm_pending_event *event;
        struct vmw_fence_obj *fence;
@@ -807,44 +806,6 @@ int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
                                         TTM_REF_USAGE);
 }
 
-/**
- * vmw_event_fence_fpriv_gone - Remove references to struct drm_file objects
- *
- * @fman: Pointer to a struct vmw_fence_manager
- * @event_list: Pointer to linked list of struct vmw_event_fence_action objects
- * with pointers to a struct drm_file object about to be closed.
- *
- * This function removes all pending fence events with references to a
- * specific struct drm_file object about to be closed. The caller is required
- * to pass a list of all struct vmw_event_fence_action objects with such
- * events attached. This function is typically called before the
- * struct drm_file object's event management is taken down.
- */
-void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman,
-                               struct list_head *event_list)
-{
-       struct vmw_event_fence_action *eaction;
-       struct drm_pending_event *event;
-       unsigned long irq_flags;
-
-       while (1) {
-               spin_lock_irqsave(&fman->lock, irq_flags);
-               if (list_empty(event_list))
-                       goto out_unlock;
-               eaction = list_first_entry(event_list,
-                                          struct vmw_event_fence_action,
-                                          fpriv_head);
-               list_del_init(&eaction->fpriv_head);
-               event = eaction->event;
-               eaction->event = NULL;
-               spin_unlock_irqrestore(&fman->lock, irq_flags);
-               event->destroy(event);
-       }
-out_unlock:
-       spin_unlock_irqrestore(&fman->lock, irq_flags);
-}
-
-
 /**
  * vmw_event_fence_action_seq_passed
  *
@@ -879,7 +840,6 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
                *eaction->tv_usec = tv.tv_usec;
        }
 
-       list_del_init(&eaction->fpriv_head);
        drm_send_event_locked(dev, eaction->event);
        eaction->event = NULL;
        spin_unlock_irqrestore(&dev->event_lock, irq_flags);
@@ -898,12 +858,6 @@ static void vmw_event_fence_action_cleanup(struct vmw_fence_action *action)
 {
        struct vmw_event_fence_action *eaction =
                container_of(action, struct vmw_event_fence_action, action);
-       struct vmw_fence_manager *fman = fman_from_fence(eaction->fence);
-       unsigned long irq_flags;
-
-       spin_lock_irqsave(&fman->lock, irq_flags);
-       list_del(&eaction->fpriv_head);
-       spin_unlock_irqrestore(&fman->lock, irq_flags);
 
        vmw_fence_obj_unreference(&eaction->fence);
        kfree(eaction);
@@ -983,8 +937,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv,
 {
        struct vmw_event_fence_action *eaction;
        struct vmw_fence_manager *fman = fman_from_fence(fence);
-       struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
-       unsigned long irq_flags;
 
        eaction = kzalloc(sizeof(*eaction), GFP_KERNEL);
        if (unlikely(eaction == NULL))
@@ -1001,10 +953,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv,
        eaction->tv_sec = tv_sec;
        eaction->tv_usec = tv_usec;
 
-       spin_lock_irqsave(&fman->lock, irq_flags);
-       list_add_tail(&eaction->fpriv_head, &vmw_fp->fence_events);
-       spin_unlock_irqrestore(&fman->lock, irq_flags);
-
        vmw_fence_obj_add_action(fence, &eaction->action);
 
        return 0;
index 8be6c29f5eb55fd8ca96bc8bd2edc68927386362..83ae301ee14181630f36faf6e711d1dffac240c0 100644 (file)
@@ -116,8 +116,6 @@ extern int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
                                     struct drm_file *file_priv);
 extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
                                 struct drm_file *file_priv);
-extern void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman,
-                                      struct list_head *event_list);
 extern int vmw_event_fence_action_queue(struct drm_file *filee_priv,
                                        struct vmw_fence_obj *fence,
                                        struct drm_pending_event *event,