From 338500c8e2ee342612d7bc4eb1cd87850228d4e2 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 5 Sep 2018 15:28:05 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1813578 Reviewed-by: svc-misra-checker Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/buddy_allocator.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/buddy_allocator.c') diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c index b29045ba..3b8d9939 100644 --- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c @@ -1281,10 +1281,10 @@ static const struct nvgpu_allocator_ops buddy_ops = { * will try and pick a reasonable max order. * @flags: Extra flags necessary. See GPU_BALLOC_*. */ -int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, - struct vm_gk20a *vm, const char *name, - u64 base, u64 size, u64 blk_size, - u64 max_order, u64 flags) +int nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, + struct vm_gk20a *vm, const char *name, + u64 base, u64 size, u64 blk_size, + u64 max_order, u64 flags) { int err; u64 pde_size; @@ -1312,7 +1312,7 @@ int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, return -ENOMEM; } - err = __nvgpu_alloc_common_init(na, g, name, a, false, &buddy_ops); + err = nvgpu_alloc_common_init(na, g, name, a, false, &buddy_ops); if (err) { goto fail; } @@ -1396,11 +1396,3 @@ fail: nvgpu_kfree(g, a); return err; } - -int nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, - const char *name, u64 base, u64 size, - u64 blk_size, u64 flags) -{ - return __nvgpu_buddy_allocator_init(g, na, NULL, name, - base, size, blk_size, 0, 0); -} -- cgit v1.2.2