summarylogtreecommitdiffstats
path: root/kernel-5.16-std.diff
blob: a86e48defb12c8f47625b74fb26a57f9f1905294 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
diff --git a/kernel/common/inc/nv.h a/kernel/common/inc/nv.h
index 2ddaa25..40a3fd5 100644
--- a/kernel/common/inc/nv.h
+++ a/kernel/common/inc/nv.h
@@ -17,13 +17,15 @@
 #include <nvlimits.h>
 
 #if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
-  #include <sys/stddef.h> // NULL
+  #include <sys/stddef.h>   // NULL
+#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
+  #include <linux/stddef.h> // NULL
 #else
-  #include <stddef.h>     // NULL
+  #include <stddef.h>       // NULL
 #endif
 
 #include <nvstatus.h>
-#include <stdarg.h>
+#include "nv_stdarg.h"
 #include <nv-caps.h>
 #include <nv-ioctl.h>
 #include <nvmisc.h>
diff --git a/kernel/common/inc/nv_stdarg.h a/kernel/common/inc/nv_stdarg.h
new file mode 100644
index 0000000..4b63340
--- /dev/null
+++ a/kernel/common/inc/nv_stdarg.h
@@ -0,0 +1,39 @@
+/*
+ * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef _NV_STDARG_H_
+#define _NV_STDARG_H_
+
+#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
+   #include "conftest.h"
+   #if defined(NV_LINUX_STDARG_H_PRESENT)
+     #include <linux/stdarg.h>
+   #else
+     #include <stdarg.h>
+   #endif   
+#else
+   #include <stdarg.h>
+#endif   
+
+#endif // _NV_STDARG_H_
diff --git a/kernel/common/inc/os-interface.h a/kernel/common/inc/os-interface.h
index b615773..dd3e7a8 100644
--- a/kernel/common/inc/os-interface.h
+++ a/kernel/common/inc/os-interface.h
@@ -24,7 +24,7 @@
 
 #include <nvtypes.h>
 #include <nvstatus.h>
-#include <stdarg.h>
+#include "nv_stdarg.h"
 #include <nv-kernel-interface-api.h>
 #include <os/nv_memory_type.h>
 
diff --git a/kernel/common/inc/rm-gpu-ops.h a/kernel/common/inc/rm-gpu-ops.h
index 67b252e..3302e72 100644
--- a/kernel/common/inc/rm-gpu-ops.h
+++ a/kernel/common/inc/rm-gpu-ops.h
@@ -16,7 +16,7 @@
 
 #include <nvtypes.h>
 #include <nvCpuUuid.h>
-#include <stdarg.h>
+#include "nv_stdarg.h"
 #include <nv-caps.h>
 #include <nv-ioctl.h>
 #include <nvmisc.h>
diff --git a/kernel/conftest.sh a/kernel/conftest.sh
index 1a1f89c..4ae52c7 100755
--- a/kernel/conftest.sh
+++ a/kernel/conftest.sh
@@ -163,6 +163,7 @@ test_headers() {
     FILES="$FILES sound/hda_codec.h"
     FILES="$FILES linux/dma-buf.h"
     FILES="$FILES linux/time.h"
+    FILES="$FILES linux/stdarg.h"
 
     translate_and_preprocess_header_files $FILES
 }
diff --git a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
index 65130fd..720e0d2 100644
--- a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
+++ a/kernel/nvidia-modeset/nvidia-modeset-os-interface.h
@@ -16,8 +16,14 @@
 #if !defined(_NVIDIA_MODESET_OS_INTERFACE_H_)
 #define _NVIDIA_MODESET_OS_INTERFACE_H_
 
-#include <stddef.h>  /* size_t */
-#include <stdarg.h>  /* va_list */
+#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
+  #include <sys/stddef.h>   // NULL
+#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
+  #include <linux/stddef.h> // NULL
+#else
+  #include <stddef.h>       // NULL
+#endif
+#include "nv_stdarg.h"  /* va_list */
 
 #include "nvtypes.h" /* NvU8 */
 
diff --git a/kernel/nvidia-modeset/nvkms.h a/kernel/nvidia-modeset/nvkms.h
index d46f97d..4180ed6 100644
--- a/kernel/nvidia-modeset/nvkms.h
+++ a/kernel/nvidia-modeset/nvkms.h
@@ -9,7 +9,13 @@
 #define __NV_KMS_H__
 
 #include "nvtypes.h"
-#include <stddef.h> /* size_t */
+#if defined(NV_KERNEL_INTERFACE_LAYER) && defined(__FreeBSD__)
+  #include <sys/stddef.h>   // NULL
+#elif defined(NV_KERNEL_INTERFACE_LAYER) && defined(NV_LINUX)
+  #include <linux/stddef.h> // NULL
+#else
+  #include <stddef.h>       // NULL
+#endif
 
 #include "nvkms-kapi.h"
 
diff --git a/kernel/nvidia-uvm/uvm_mmu.c a/kernel/nvidia-uvm/uvm_mmu.c
index 68c77be..333da8b 100644
--- a/kernel/nvidia-uvm/uvm_mmu.c
+++ a/kernel/nvidia-uvm/uvm_mmu.c
@@ -32,7 +32,7 @@
 #include "uvm_push.h"
 #include "uvm_mem.h"
 #include "uvm_va_space.h"
-#include <stdarg.h>
+#include "nv_stdarg.h"
 
 
 
diff --git a/kernel/nvidia/export_nvswitch.h a/kernel/nvidia/export_nvswitch.h
index e45666c..618a3e7 100644
--- a/kernel/nvidia/export_nvswitch.h
+++ a/kernel/nvidia/export_nvswitch.h
@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-#include <stdarg.h>
+#include "nv_stdarg.h"
 #include "nvlink_common.h"
 #include "ioctl_common_nvswitch.h"