18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 28c2ecf20Sopenharmony_ci#ifndef __NVIF_PRINTF_H__ 38c2ecf20Sopenharmony_ci#define __NVIF_PRINTF_H__ 48c2ecf20Sopenharmony_ci#include <nvif/client.h> 58c2ecf20Sopenharmony_ci#include <nvif/parent.h> 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define NVIF_PRINT(l,o,f,a...) do { \ 88c2ecf20Sopenharmony_ci struct nvif_object *_o = (o); \ 98c2ecf20Sopenharmony_ci struct nvif_parent *_p = _o->parent; \ 108c2ecf20Sopenharmony_ci _p->func->l(_o, "[%s/%08x:%s] "f"\n", _o->client->object.name, _o->handle, _o->name, ##a); \ 118c2ecf20Sopenharmony_ci} while(0) 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef NVIF_DEBUG_PRINT_DISABLE 148c2ecf20Sopenharmony_ci#define NVIF_DEBUG(o,f,a...) NVIF_PRINT(debugf, (o), f, ##a) 158c2ecf20Sopenharmony_ci#else 168c2ecf20Sopenharmony_ci#define NVIF_DEBUG(o,f,a...) 178c2ecf20Sopenharmony_ci#endif 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define NVIF_ERROR(o,f,a...) NVIF_PRINT(errorf, (o), f, ##a) 208c2ecf20Sopenharmony_ci#endif 21