gpu: nvgpu: cleanup based on code inspection

Fix the following issues in Posix utils unit which were
identified during code inspection,
 - Remove the usage of #undef.
 - Avoid defining reserved identifiers.

Jira NVGPU-4993

Change-Id: I16189bfad5bba87ee73a26d61d19caefd5d852c2
Signed-off-by: ajesh <akv@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2292415
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Alex Waterman <alexw@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-10 15:12:03 +05:30
committed by Alex Waterman
parent b0984cbf05
commit 9c99dc4c4d

View File

@@ -23,6 +23,8 @@
#ifndef NVGPU_POSIX_UTILS_H #ifndef NVGPU_POSIX_UTILS_H
#define NVGPU_POSIX_UTILS_H #define NVGPU_POSIX_UTILS_H
#include <stdlib.h>
#include <nvgpu/static_analysis.h> #include <nvgpu/static_analysis.h>
/** /**
@@ -41,13 +43,7 @@
(t_a < t_b) ? t_a : t_b; \ (t_a < t_b) ? t_a : t_b; \
}) })
#if defined(min) #ifndef _QNX_SOURCE
#undef min
#endif
#if defined(max)
#undef max
#endif
/** /**
* @brief Minimum of two values. * @brief Minimum of two values.
* *
@@ -56,11 +52,12 @@
* *
* @return Returns the minimum value from \a a and \a b. * @return Returns the minimum value from \a a and \a b.
*/ */
#ifndef min
#define min(a, b) \ #define min(a, b) \
({ \ ({ \
((a) < (b)) ? (a) : (b); \ ((a) < (b)) ? (a) : (b); \
}) })
#endif
/** /**
* @brief Maximum of two values. * @brief Maximum of two values.
* *
@@ -69,11 +66,13 @@
* *
* @return Returns the maximum value from \a a and \a b. * @return Returns the maximum value from \a a and \a b.
*/ */
#ifndef max
#define max(a, b) \ #define max(a, b) \
({ \ ({ \
((a) > (b)) ? (a) : (b); \ ((a) > (b)) ? (a) : (b); \
}) })
#endif
#endif
/** /**
* @brief Minimum of three values. * @brief Minimum of three values.
* *