Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 #ifndef __NVIF_PRINTF_H__
0003 #define __NVIF_PRINTF_H__
0004 #include <nvif/client.h>
0005 #include <nvif/parent.h>
0006 
0007 #define NVIF_PRINT(l,o,f,a...) do {                                                                \
0008     struct nvif_object *_o = (o);                                                              \
0009     struct nvif_parent *_p = _o->parent;                                                       \
0010     _p->func->l(_o, "[%s/%08x:%s] "f"\n", _o->client->object.name, _o->handle, _o->name, ##a); \
0011 } while(0)
0012 
0013 #ifndef NVIF_DEBUG_PRINT_DISABLE
0014 #define NVIF_DEBUG(o,f,a...) NVIF_PRINT(debugf, (o), f, ##a)
0015 #else
0016 #define NVIF_DEBUG(o,f,a...)
0017 #endif
0018 
0019 #define NVIF_ERROR(o,f,a...) NVIF_PRINT(errorf, (o), f, ##a)
0020 #define NVIF_ERRON(c,o,f,a...) do {                            \
0021     struct nvif_object *_object = (o);                     \
0022     int _cond = (c);                                       \
0023     if (_cond) {                                           \
0024         NVIF_ERROR(_object, f" (ret:%d)", ##a, _cond); \
0025     } else {                                               \
0026         NVIF_DEBUG(_object, f, ##a);                   \
0027     }                                                      \
0028 } while(0)
0029 #endif