1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVIF_NOTIFY_H__
3 #define __NVIF_NOTIFY_H__
4 
5 struct nvif_notify {
6 	struct nvif_object *object;
7 	const char *name;
8 	int index;
9 
10 #define NVIF_NOTIFY_USER 0
11 #define NVIF_NOTIFY_WORK 1
12 	unsigned long flags;
13 	atomic_t putcnt;
14 	void (*dtor)(struct nvif_notify *);
15 #define NVIF_NOTIFY_DROP 0
16 #define NVIF_NOTIFY_KEEP 1
17 	int  (*func)(struct nvif_notify *);
18 
19 	/* this is const for a *very* good reason - the data might be on the
20 	 * stack from an irq handler.  if you're not nvif/notify.c then you
21 	 * should probably think twice before casting it away...
22 	 */
23 	const void *data;
24 	u32 size;
25 	struct work_struct work;
26 };
27 
28 int  nvif_notify_ctor(struct nvif_object *, const char *name,
29 		      int (*func)(struct nvif_notify *), bool work, u8 type,
30 		      void *data, u32 size, u32 reply, struct nvif_notify *);
31 int  nvif_notify_dtor(struct nvif_notify *);
32 int  nvif_notify_get(struct nvif_notify *);
33 int  nvif_notify_put(struct nvif_notify *);
34 int  nvif_notify(const void *, u32, const void *, u32);
35 #endif
36