mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-17 01:54:01 +08:00
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: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
a25f83ba89
commit
019255797d
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user