1 | #ifndef __NVKM_EVENT_H__ |
2 | #define __NVKM_EVENT_H__ |
3 | |
4 | /* return codes from event handlers */ |
5 | #define NVKM_EVENT_DROP 0 |
6 | #define NVKM_EVENT_KEEP 1 |
7 | |
8 | /* nouveau_eventh.flags bit #s */ |
9 | #define NVKM_EVENT_ENABLE 0 |
10 | |
11 | struct nouveau_eventh { |
12 | struct nouveau_event *event; |
13 | struct list_head head; |
14 | unsigned long flags; |
15 | int index; |
16 | int (*func)(void *, int); |
17 | void *priv; |
18 | }; |
19 | |
20 | struct nouveau_event { |
21 | spinlock_t list_lock; |
22 | spinlock_t refs_lock; |
23 | |
24 | void *priv; |
25 | void (*enable)(struct nouveau_event *, int index); |
26 | void (*disable)(struct nouveau_event *, int index); |
27 | |
28 | int index_nr; |
29 | struct { |
30 | struct list_head list; |
31 | int refs; |
32 | } index[]; |
33 | }; |
34 | |
35 | int nouveau_event_create(int index_nr, struct nouveau_event **); |
36 | void nouveau_event_destroy(struct nouveau_event **); |
37 | void nouveau_event_trigger(struct nouveau_event *, int index); |
38 | |
39 | int nouveau_event_new(struct nouveau_event *, int index, |
40 | int (*func)(void *, int), void *, |
41 | struct nouveau_eventh **); |
42 | void nouveau_event_ref(struct nouveau_eventh *, struct nouveau_eventh **); |
43 | void nouveau_event_get(struct nouveau_eventh *); |
44 | void nouveau_event_put(struct nouveau_eventh *); |
45 | |
46 | #endif |
47 | |