1 #ifndef __NVKM_CLIENT_H__
2 #define __NVKM_CLIENT_H__
3 #include <core/namedb.h>
6 struct nvkm_namedb namedb;
7 struct nvkm_handle *root;
8 struct nvkm_object *device;
15 int (*ntfy)(const void *, u32, const void *, u32);
16 struct nvkm_client_notify *notify[16];
19 static inline struct nvkm_client *
22 #if CONFIG_NOUVEAU_DEBUG >= NV_DBG_PARANOIA
23 if (unlikely(!nv_iclass(obj, NV_CLIENT_CLASS)))
24 nv_assert("BAD CAST -> NvClient, %08x", nv_hclass(obj));
29 static inline struct nvkm_client *
30 nvkm_client(void *obj)
32 struct nvkm_object *client = nv_object(obj);
33 while (client && !(nv_iclass(client, NV_CLIENT_CLASS)))
34 client = client->parent;
35 return (void *)client;
38 #define nvkm_client_create(n,c,oc,od,d) \
39 nvkm_client_create_((n), (c), (oc), (od), sizeof(**d), (void **)d)
41 int nvkm_client_create_(const char *name, u64 device, const char *cfg,
42 const char *dbg, int, void **);
43 #define nvkm_client_destroy(p) \
44 nvkm_namedb_destroy(&(p)->base)
46 int nvkm_client_init(struct nvkm_client *);
47 int nvkm_client_fini(struct nvkm_client *, bool suspend);
48 const char *nvkm_client_name(void *obj);
50 int nvkm_client_notify_new(struct nvkm_object *, struct nvkm_event *,
51 void *data, u32 size);
52 int nvkm_client_notify_del(struct nvkm_client *, int index);
53 int nvkm_client_notify_get(struct nvkm_client *, int index);
54 int nvkm_client_notify_put(struct nvkm_client *, int index);