From f0904be5e4bcd3d4c1bc18534129ee9418b97153 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 16 May 2018 13:06:06 -0700 Subject: gpu: nvgpu: posix: undef min, max macros is defined These macros are sometimes defined by the std library headers. So when they are defined #undef them and use our own version. Also explicitly include types.h from gmmu.c since it uses the min and max macros. JIRA NVGPU-525 Change-Id: I905ff23ef7a4a96467be59c4a124cb09b63f1f96 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1721015 Reviewed-by: svc-mobile-coverity Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/gmmu.c | 1 + drivers/gpu/nvgpu/include/nvgpu/posix/types.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/mm/gmmu.c b/drivers/gpu/nvgpu/common/mm/gmmu.c index 0b57b88d..1e4065ba 100644 --- a/drivers/gpu/nvgpu/common/mm/gmmu.c +++ b/drivers/gpu/nvgpu/common/mm/gmmu.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/mm_gk20a.h" diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/types.h b/drivers/gpu/nvgpu/include/nvgpu/posix/types.h index 10754a09..71bac1d0 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/types.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/types.h @@ -55,16 +55,22 @@ typedef long long s64; __a < __b ? __a : __b; \ }) +#if defined(min) +#undef min +#endif +#if defined(max) +#undef max +#endif + #define min(a, b) \ ({ \ (a) < (b) ? a : b; \ }) -#define min3(a, b, c) min(min(a, b), c) - #define max(a, b) \ ({ \ (a) > (b) ? a : b; \ }) +#define min3(a, b, c) min(min(a, b), c) #define PAGE_SIZE 4096 -- cgit v1.2.2