summaryrefslogtreecommitdiff
path: root/src/drm/drm_util.h
blob: 540a07acfc3134e17dfcb54dd1692cc67f8708af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright 2022 Google LLC
 * SPDX-License-Identifier: MIT
 */

#ifndef DRM_UTIL_H_
#define DRM_UTIL_H_

#pragma GCC diagnostic push

#if defined(__clang__)
#pragma GCC diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wlanguage-extension-token"
#pragma GCC diagnostic ignored "-Wgnu-statement-expression"
#endif

#if defined(__GNUC__)
#pragma GCC diagnostic ignored "-Wpedantic"
#endif

#include "linux/overflow.h"

#pragma GCC diagnostic pop

void _drm_log(const char *fmt, ...);
#define drm_log(fmt, ...) _drm_log("%s:%d: " fmt, __func__, __LINE__, ##__VA_ARGS__)

#if 0
#define drm_dbg drm_log
#else
#define drm_dbg(fmt, ...)                                                                \
   do {                                                                                  \
   } while (0)
#endif

#define VOID2U64(x) ((uint64_t)(unsigned long)(x))
#define U642VOID(x) ((void *)(unsigned long)(x))

#ifndef NSEC_PER_SEC
#define NSEC_PER_SEC 1000000000ull
#endif

#endif /* DRM_UTIL_H_ */