diff options
author | Alex Waterman <alexw@nvidia.com> | 2018-09-05 18:28:05 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-12 20:48:11 -0400 |
commit | 338500c8e2ee342612d7bc4eb1cd87850228d4e2 (patch) | |
tree | 55f607de797b24577fb03158c33738322b54e100 /drivers/gpu/nvgpu/include | |
parent | 19434a22454778a14cd918ad6a0ec061634a1fc2 (diff) |
gpu: nvgpu: Fix MISRA 21.2 violations (public allocator APIs)
MISRA 21.2 states that we may not use reserved identifiers; since
all identifiers beginning with '_' are reserved by libc, the usage
of '__' as a prefix is disallowed.
This fixes places in the public allocator APIs. This consists of
the various init routines which are used to create an allocator
and the debug macro used within the allocator code.
The buddy allocator was handled by collapsing the internal
'__' prepended version with the non-prefixed version. The only
required change was in the page_allocator code which now had to
pass in a NULL vm pointer (since the VM is not needed for managing
VIDMEM).
JIRA NVGPU-1029
Change-Id: I484a144e61789bf594c525c1ca307b96d120830f
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1813578
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/include')
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/allocator.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/allocator.h b/drivers/gpu/nvgpu/include/nvgpu/allocator.h index 2d9b3d32..2bff0efd 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/allocator.h +++ b/drivers/gpu/nvgpu/include/nvgpu/allocator.h | |||
@@ -129,11 +129,11 @@ nvgpu_alloc_carveout_from_co_entry(struct nvgpu_list_node *node) | |||
129 | ((uintptr_t)node - offsetof(struct nvgpu_alloc_carveout, co_entry)); | 129 | ((uintptr_t)node - offsetof(struct nvgpu_alloc_carveout, co_entry)); |
130 | }; | 130 | }; |
131 | 131 | ||
132 | #define NVGPU_CARVEOUT(__name, __base, __length) \ | 132 | #define NVGPU_CARVEOUT(local_name, local_base, local_length) \ |
133 | { \ | 133 | { \ |
134 | .name = (__name), \ | 134 | .name = (local_name), \ |
135 | .base = (__base), \ | 135 | .base = (local_base), \ |
136 | .length = (__length) \ | 136 | .length = (local_length) \ |
137 | } | 137 | } |
138 | 138 | ||
139 | /* | 139 | /* |
@@ -207,13 +207,10 @@ static inline void alloc_unlock(struct nvgpu_allocator *a) | |||
207 | /* | 207 | /* |
208 | * Buddy allocator specific initializers. | 208 | * Buddy allocator specific initializers. |
209 | */ | 209 | */ |
210 | int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, | 210 | int nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, |
211 | struct vm_gk20a *vm, const char *name, | 211 | struct vm_gk20a *vm, const char *name, |
212 | u64 base, u64 size, u64 blk_size, | 212 | u64 base, u64 size, u64 blk_size, |
213 | u64 max_order, u64 flags); | 213 | u64 max_order, u64 flags); |
214 | int nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, | ||
215 | const char *name, u64 base, u64 size, | ||
216 | u64 blk_size, u64 flags); | ||
217 | 214 | ||
218 | /* | 215 | /* |
219 | * Bitmap initializers. | 216 | * Bitmap initializers. |
@@ -282,9 +279,9 @@ void nvgpu_init_alloc_debug(struct gk20a *g, struct nvgpu_allocator *a); | |||
282 | void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); | 279 | void nvgpu_fini_alloc_debug(struct nvgpu_allocator *a); |
283 | #endif | 280 | #endif |
284 | 281 | ||
285 | int __nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g, | 282 | int nvgpu_alloc_common_init(struct nvgpu_allocator *a, struct gk20a *g, |
286 | const char *name, void *priv, bool dbg, | 283 | const char *name, void *priv, bool dbg, |
287 | const struct nvgpu_allocator_ops *ops); | 284 | const struct nvgpu_allocator_ops *ops); |
288 | 285 | ||
289 | static inline void nvgpu_alloc_enable_dbg(struct nvgpu_allocator *a) | 286 | static inline void nvgpu_alloc_enable_dbg(struct nvgpu_allocator *a) |
290 | { | 287 | { |
@@ -309,7 +306,7 @@ static inline void nvgpu_alloc_disable_dbg(struct nvgpu_allocator *a) | |||
309 | } while (0) | 306 | } while (0) |
310 | #endif | 307 | #endif |
311 | 308 | ||
312 | #define __alloc_dbg(a, fmt, arg...) \ | 309 | #define do_alloc_dbg(a, fmt, arg...) \ |
313 | nvgpu_log((a)->g, gpu_dbg_alloc, "%25s " fmt, (a)->name, ##arg) | 310 | nvgpu_log((a)->g, gpu_dbg_alloc, "%25s " fmt, (a)->name, ##arg) |
314 | 311 | ||
315 | /* | 312 | /* |
@@ -325,10 +322,10 @@ static inline void nvgpu_alloc_disable_dbg(struct nvgpu_allocator *a) | |||
325 | #define alloc_dbg(a, fmt, arg...) \ | 322 | #define alloc_dbg(a, fmt, arg...) \ |
326 | do { \ | 323 | do { \ |
327 | if ((a)->debug) \ | 324 | if ((a)->debug) \ |
328 | __alloc_dbg((a), fmt, ##arg); \ | 325 | do_alloc_dbg((a), fmt, ##arg); \ |
329 | } while (0) | 326 | } while (0) |
330 | #else | 327 | #else |
331 | #define alloc_dbg(a, fmt, arg...) __alloc_dbg(a, fmt, ##arg) | 328 | #define alloc_dbg(a, fmt, arg...) do_alloc_dbg(a, fmt, ##arg) |
332 | #endif | 329 | #endif |
333 | 330 | ||
334 | #endif /* NVGPU_ALLOCATOR_H */ | 331 | #endif /* NVGPU_ALLOCATOR_H */ |