summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2018-05-16 16:06:06 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-30 14:56:06 -0400
commitf0904be5e4bcd3d4c1bc18534129ee9418b97153 (patch)
treed88ed0dfa2559c8c7bbca2a65767beb1c22b51f2 /drivers
parent5b5b7c43224b612fb7885a65813f4ed99c81da6f (diff)
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 <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1721015 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/common/mm/gmmu.c1
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/posix/types.h10
2 files changed, 9 insertions, 2 deletions
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 @@
31#include <nvgpu/barrier.h> 31#include <nvgpu/barrier.h>
32#include <nvgpu/vidmem.h> 32#include <nvgpu/vidmem.h>
33#include <nvgpu/sizes.h> 33#include <nvgpu/sizes.h>
34#include <nvgpu/types.h>
34 35
35#include "gk20a/gk20a.h" 36#include "gk20a/gk20a.h"
36#include "gk20a/mm_gk20a.h" 37#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;
55 __a < __b ? __a : __b; \ 55 __a < __b ? __a : __b; \
56 }) 56 })
57 57
58#if defined(min)
59#undef min
60#endif
61#if defined(max)
62#undef max
63#endif
64
58#define min(a, b) \ 65#define min(a, b) \
59 ({ \ 66 ({ \
60 (a) < (b) ? a : b; \ 67 (a) < (b) ? a : b; \
61 }) 68 })
62#define min3(a, b, c) min(min(a, b), c)
63
64#define max(a, b) \ 69#define max(a, b) \
65 ({ \ 70 ({ \
66 (a) > (b) ? a : b; \ 71 (a) > (b) ? a : b; \
67 }) 72 })
73#define min3(a, b, c) min(min(a, b), c)
68 74
69#define PAGE_SIZE 4096 75#define PAGE_SIZE 4096
70 76