Commit 01925579 authored by Peter Hurley's avatar Peter Hurley Committed by Ben Skeggs

drm/nouveau/core: Move event index check from critical section

The index_nr field is constant for the lifetime of the event, so
serialized access is unnecessary.
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a25f83ba
......@@ -40,8 +40,10 @@ 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);
spin_unlock_irqrestore(&event->lock, flags);
}
......@@ -52,14 +54,15 @@ 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);
}
}
spin_unlock_irqrestore(&event->lock, flags);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment