drm/nouveau/core: allow non-maskable events
authorBen Skeggs <bskeggs@redhat.com>
Fri, 26 Apr 2013 02:03:10 +0000 (12:03 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 26 Apr 2013 05:38:16 +0000 (15:38 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/core/event.c

index 6d01e0f0fc8a35575086cfd9fdfa3dd54b89a72b..7eb81c1b6fabf9e58444f3f4a7c254ef01436bab 100644 (file)
@@ -27,8 +27,10 @@ static void
 nouveau_event_put_locked(struct nouveau_event *event, int index,
                         struct nouveau_eventh *handler)
 {
-       if (!--event->index[index].refs)
-               event->disable(event, index);
+       if (!--event->index[index].refs) {
+               if (event->disable)
+                       event->disable(event, index);
+       }
        list_del(&handler->head);
 }
 
@@ -53,8 +55,10 @@ nouveau_event_get(struct nouveau_event *event, int index,
        spin_lock_irqsave(&event->lock, flags);
        if (index < event->index_nr) {
                list_add(&handler->head, &event->index[index].list);
-               if (!event->index[index].refs++)
-                       event->enable(event, index);
+               if (!event->index[index].refs++) {
+                       if (event->enable)
+                               event->enable(event, index);
+               }
        }
        spin_unlock_irqrestore(&event->lock, flags);
 }