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>
This commit is contained in:
Alex Waterman
2018-09-05 15:28:05 -07:00
committed by mobile promotions
parent 19434a2245
commit 338500c8e2
7 changed files with 54 additions and 64 deletions

View File

@@ -174,7 +174,7 @@ static struct nvgpu_bitmap_alloc *find_alloc_metadata(
/*
* Tree of alloc meta data stores the address of the alloc not the bit offset.
*/
static int __nvgpu_bitmap_store_alloc(struct nvgpu_bitmap_allocator *a,
static int nvgpu_bitmap_store_alloc(struct nvgpu_bitmap_allocator *a,
u64 addr, u64 len)
{
struct nvgpu_bitmap_alloc *alloc =
@@ -244,7 +244,7 @@ static u64 nvgpu_bitmap_alloc(struct nvgpu_allocator *na, u64 len)
* data it needs around to successfully free this allocation.
*/
if (!(a->flags & GPU_ALLOC_NO_ALLOC_PAGE) &&
__nvgpu_bitmap_store_alloc(a, addr, blks * a->blk_size)) {
nvgpu_bitmap_store_alloc(a, addr, blks * a->blk_size)) {
goto fail_reset_bitmap;
}
@@ -401,7 +401,7 @@ int nvgpu_bitmap_allocator_init(struct gk20a *g, struct nvgpu_allocator *na,
return -ENOMEM;
}
err = __nvgpu_alloc_common_init(na, g, name, a, false, &bitmap_ops);
err = nvgpu_alloc_common_init(na, g, name, a, false, &bitmap_ops);
if (err) {
goto fail;
}