From 9c99dc4c4d6f741424f36c86b9bedd9c15d35300 Mon Sep 17 00:00:00 2001 From: ajesh Date: Mon, 10 Feb 2020 15:12:03 +0530 Subject: [PATCH] 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2292415 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Scott Long Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/utils.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h index 49300fca7..9cd5f12c8 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h @@ -23,6 +23,8 @@ #ifndef NVGPU_POSIX_UTILS_H #define NVGPU_POSIX_UTILS_H +#include + #include /** @@ -41,13 +43,7 @@ (t_a < t_b) ? t_a : t_b; \ }) -#if defined(min) -#undef min -#endif -#if defined(max) -#undef max -#endif - +#ifndef _QNX_SOURCE /** * @brief Minimum of two values. * @@ -56,11 +52,12 @@ * * @return Returns the minimum value from \a a and \a b. */ +#ifndef min #define min(a, b) \ ({ \ ((a) < (b)) ? (a) : (b); \ }) - +#endif /** * @brief Maximum of two values. * @@ -69,11 +66,13 @@ * * @return Returns the maximum value from \a a and \a b. */ +#ifndef max #define max(a, b) \ ({ \ ((a) > (b)) ? (a) : (b); \ }) - +#endif +#endif /** * @brief Minimum of three values. *