]> git.samba.org - sfrench/cifs-2.6.git/blob - drivers/gpu/drm/nouveau/include/nvkm/core/client.h
zonefs: convert zonefs to use the new mount api
[sfrench/cifs-2.6.git] / drivers / gpu / drm / nouveau / include / nvkm / core / client.h
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_CLIENT_H__
3 #define __NVKM_CLIENT_H__
4 #define nvkm_client(p) container_of((p), struct nvkm_client, object)
5 #include <core/object.h>
6
7 struct nvkm_client {
8         struct nvkm_object object;
9         char name[32];
10         u64 device;
11         u32 debug;
12
13         struct rb_root objroot;
14
15         void *data;
16         int (*event)(u64 token, void *argv, u32 argc);
17
18         struct list_head umem;
19         spinlock_t lock;
20 };
21
22 int  nvkm_client_new(const char *name, u64 device, const char *cfg, const char *dbg,
23                      int (*)(u64, void *, u32), struct nvkm_client **);
24 struct nvkm_client *nvkm_client_search(struct nvkm_client *, u64 handle);
25
26 /* logging for client-facing objects */
27 #define nvif_printk(o,l,p,f,a...) do {                                         \
28         const struct nvkm_object *_object = (o);                               \
29         const struct nvkm_client *_client = _object->client;                   \
30         if (_client->debug >= NV_DBG_##l)                                      \
31                 printk(KERN_##p "nouveau: %s:%08x:%08x: "f, _client->name,     \
32                        _object->handle, _object->oclass, ##a);                 \
33 } while(0)
34 #define nvif_fatal(o,f,a...) nvif_printk((o), FATAL, CRIT, f, ##a)
35 #define nvif_error(o,f,a...) nvif_printk((o), ERROR,  ERR, f, ##a)
36 #define nvif_debug(o,f,a...) nvif_printk((o), DEBUG, INFO, f, ##a)
37 #define nvif_trace(o,f,a...) nvif_printk((o), TRACE, INFO, f, ##a)
38 #define nvif_info(o,f,a...)  nvif_printk((o),  INFO, INFO, f, ##a)
39 #define nvif_ioctl(o,f,a...) nvif_trace((o), "ioctl: "f, ##a)
40 #endif