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