gpu: nvgpu: avoid hard coded constants

Replace the hard coded numeric constants in posix unit.

Jira NVGPU-4954

Change-Id: I9f57e2d60b44c942924c47a7e38c237c732b13b0
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2289633
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
ajesh
2020-02-04 15:30:35 +05:30
committed by Alex Waterman
parent 9ca89fa97f
commit 1c1dca5d6f
6 changed files with 51 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -34,6 +34,7 @@
unsigned long nvgpu_posix_ffs(unsigned long word)
{
int ret = 0;
const int maxvalue = 64;
if ((word & (unsigned long) LONG_MAX) != 0UL) {
ret = __builtin_ffsl(
@@ -42,7 +43,7 @@ unsigned long nvgpu_posix_ffs(unsigned long word)
} else {
NVGPU_COV_WHITELIST(false_positive, NVGPU_MISRA(Rule, 14_3), "Bug 2615925")
if (word > (unsigned long) LONG_MAX) {
ret = (int) 64;
ret = maxvalue;
}
}