1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_NOTIFY_H__
3 #define __NVKM_NOTIFY_H__
4 #include <core/os.h>
5 struct nvkm_object;
6 
7 struct nvkm_notify {
8 	struct nvkm_event *event;
9 	struct list_head head;
10 #define NVKM_NOTIFY_USER 0
11 #define NVKM_NOTIFY_WORK 1
12 	unsigned long flags;
13 	int block;
14 #define NVKM_NOTIFY_DROP 0
15 #define NVKM_NOTIFY_KEEP 1
16 	int (*func)(struct nvkm_notify *);
17 
18 	/* set by nvkm_event ctor */
19 	u32 types;
20 	int index;
21 	u32 size;
22 
23 	struct work_struct work;
24 	/* this is const for a *very* good reason - the data might be on the
25 	 * stack from an irq handler.  if you're not core/notify.c then you
26 	 * should probably think twice before casting it away...
27 	 */
28 	const void *data;
29 };
30 
31 int  nvkm_notify_init(struct nvkm_object *, struct nvkm_event *,
32 		      int (*func)(struct nvkm_notify *), bool work,
33 		      void *data, u32 size, u32 reply,
34 		      struct nvkm_notify *);
35 void nvkm_notify_fini(struct nvkm_notify *);
36 void nvkm_notify_get(struct nvkm_notify *);
37 void nvkm_notify_put(struct nvkm_notify *);
38 void nvkm_notify_send(struct nvkm_notify *, void *data, u32 size);
39 #endif
40