@@ -29,7 +29,7 @@ nouveau_event_put_locked(struct nouveau_event *event, int index,
{
if (!--event->index[index].refs)
event->disable(event, index);
- list_del(&handler->head);
+ list_del(&handler->heads[index]);
}
void
@@ -39,7 +39,7 @@ nouveau_event_put(struct nouveau_event *event, int index,
unsigned long flags;
spin_lock_irqsave(&event->lock, flags);
- if (index < event->index_nr)
+ if (index < ARRAY_SIZE(handler->heads) && index < event->index_nr)
nouveau_event_put_locked(event, index, handler);
spin_unlock_irqrestore(&event->lock, flags);
}
@@ -51,8 +51,8 @@ nouveau_event_get(struct nouveau_event *event, int index,
unsigned long flags;
spin_lock_irqsave(&event->lock, flags);
- if (index < event->index_nr) {
- list_add(&handler->head, &event->index[index].list);
+ if (index < ARRAY_SIZE(handler->heads) && index < event->index_nr) {
+ list_add(&handler->heads[index], &event->index[index].list);
if (!event->index[index].refs++)
event->enable(event, index);
}
@@ -69,7 +69,7 @@ nouveau_event_trigger(struct nouveau_event *event, int index)
return;
spin_lock_irqsave(&event->lock, flags);
- list_for_each_entry_safe(handler, temp, &event->index[index].list, head) {
+ list_for_each_entry_safe(handler, temp, &event->index[index].list, heads[index]) {
if (handler->func(handler, index) == NVKM_EVENT_DROP) {
nouveau_event_put_locked(event, index, handler);
}
@@ -6,7 +6,7 @@
#define NVKM_EVENT_KEEP 1
struct nouveau_eventh {
- struct list_head head;
+ struct list_head heads[2];
int (*func)(struct nouveau_eventh *, int index);
};