178201Sdd/* SPDX-License-Identifier: MIT */ 278201Sdd#ifndef __NVIF_PRINTF_H__ 31590Srgrimes#define __NVIF_PRINTF_H__ 41590Srgrimes#include <nvif/client.h> 51590Srgrimes#include <nvif/parent.h> 6226361Sed 7201386Sed#define NVIF_PRINT(l,o,f,a...) do { \ 81590Srgrimes struct nvif_object *_o = (o); \ 9 struct nvif_parent *_p = _o->parent; \ 10 _p->func->l(_o, "[%s/%08x:%s] "f"\n", _o->client->object.name, _o->handle, _o->name, ##a); \ 11} while(0) 12 13#ifndef NVIF_DEBUG_PRINT_DISABLE 14#define NVIF_DEBUG(o,f,a...) NVIF_PRINT(debugf, (o), f, ##a) 15#else 16#define NVIF_DEBUG(o,f,a...) 17#endif 18 19#define NVIF_ERROR(o,f,a...) NVIF_PRINT(errorf, (o), f, ##a) 20#define NVIF_ERRON(c,o,f,a...) do { \ 21 struct nvif_object *_object = (o); \ 22 int _cond = (c); \ 23 if (_cond) { \ 24 NVIF_ERROR(_object, f" (ret:%d)", ##a, _cond); \ 25 } else { \ 26 NVIF_DEBUG(_object, f, ##a); \ 27 } \ 28} while(0) 29#endif 30