1 #ifndef __NVKM_EVENT_H__
2 #define __NVKM_EVENT_H__
3 #include <core/os.h>
4 struct nvkm_notify;
5 struct nvkm_object;
6 
7 struct nvkm_event {
8 	const struct nvkm_event_func *func;
9 
10 	int types_nr;
11 	int index_nr;
12 
13 	spinlock_t refs_lock;
14 	spinlock_t list_lock;
15 	struct list_head list;
16 	int *refs;
17 };
18 
19 struct nvkm_event_func {
20 	int  (*ctor)(struct nvkm_object *, void *data, u32 size,
21 		     struct nvkm_notify *);
22 	void (*send)(void *data, u32 size, struct nvkm_notify *);
23 	void (*init)(struct nvkm_event *, int type, int index);
24 	void (*fini)(struct nvkm_event *, int type, int index);
25 };
26 
27 int  nvkm_event_init(const struct nvkm_event_func *func, int types_nr,
28 		     int index_nr, struct nvkm_event *);
29 void nvkm_event_fini(struct nvkm_event *);
30 void nvkm_event_get(struct nvkm_event *, u32 types, int index);
31 void nvkm_event_put(struct nvkm_event *, u32 types, int index);
32 void nvkm_event_send(struct nvkm_event *, u32 types, int index,
33 		     void *data, u32 size);
34 #endif
35