]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
drm/nouveau/core: Move event index check from critical section
authorPeter Hurley <peter@hurleysoftware.com>
Tue, 27 Aug 2013 20:12:55 +0000 (16:12 -0400)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 8 Nov 2013 05:36:03 +0000 (15:36 +1000)
The index_nr field is constant for the lifetime of the event, so
serialized access is unnecessary.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/core/event.c

index 7eb81c1b6fabf9e58444f3f4a7c254ef01436bab..e69c463e66e25540c16bbd67a87965d1261229ec 100644 (file)
@@ -40,9 +40,11 @@ nouveau_event_put(struct nouveau_event *event, int index,
 {
        unsigned long flags;
 
+       if (index >= event->index_nr)
+               return;
+
        spin_lock_irqsave(&event->lock, flags);
-       if (index < event->index_nr)
-               nouveau_event_put_locked(event, index, handler);
+       nouveau_event_put_locked(event, index, handler);
        spin_unlock_irqrestore(&event->lock, flags);
 }
 
@@ -52,13 +54,14 @@ nouveau_event_get(struct nouveau_event *event, int index,
 {
        unsigned long flags;
 
+       if (index >= event->index_nr)
+               return;
+
        spin_lock_irqsave(&event->lock, flags);
-       if (index < event->index_nr) {
-               list_add(&handler->head, &event->index[index].list);
-               if (!event->index[index].refs++) {
-                       if (event->enable)
-                               event->enable(event, index);
-               }
+       list_add(&handler->head, &event->index[index].list);
+       if (!event->index[index].refs++) {
+               if (event->enable)
+                       event->enable(event, index);
        }
        spin_unlock_irqrestore(&event->lock, flags);
 }