diff options
author | Alex Waterman <alexw@nvidia.com> | 2018-08-10 19:12:35 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-21 17:54:16 -0400 |
commit | 14cf2edac71a57a277dc671d02c9a237026aa482 (patch) | |
tree | d85461888639c303ed4daf76d07166ee2be2705a /drivers | |
parent | bf8a1e0019d032928f6cdf44da59ebc4874047e0 (diff) |
gpu: nvgpu: Add BIT32() and BIT64() macros
Provide both a BIT32() and BIT64() macro so that bit fields
can be sized appropriately. The existing BIT() macro is now
deprecated and should not be used. Instead use the explicitly
sized macros.
JIRA NVGPU-781
Change-Id: I9309bd0cda8f811934b7388990e12d0e02436eb0
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1797197
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
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/include/nvgpu/bitops.h | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/posix/bitops.h | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/bitops.h b/drivers/gpu/nvgpu/include/nvgpu/bitops.h index 26b6e19d..8760708e 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/bitops.h +++ b/drivers/gpu/nvgpu/include/nvgpu/bitops.h | |||
@@ -22,6 +22,14 @@ | |||
22 | #ifndef __NVGPU_BITOPS_H__ | 22 | #ifndef __NVGPU_BITOPS_H__ |
23 | #define __NVGPU_BITOPS_H__ | 23 | #define __NVGPU_BITOPS_H__ |
24 | 24 | ||
25 | #include <nvgpu/types.h> | ||
26 | |||
27 | /* | ||
28 | * Explicit sizes for bit definitions. Please use these instead of BIT(). | ||
29 | */ | ||
30 | #define BIT32(i) (U32(1) << (i)) | ||
31 | #define BIT64(i) (U64(1) << (i)) | ||
32 | |||
25 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
26 | #include <linux/bitops.h> | 34 | #include <linux/bitops.h> |
27 | #include <linux/bitmap.h> | 35 | #include <linux/bitmap.h> |
diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/bitops.h b/drivers/gpu/nvgpu/include/nvgpu/posix/bitops.h index 94618d14..e8c663b0 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/bitops.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/bitops.h | |||
@@ -33,7 +33,10 @@ | |||
33 | #define BITS_TO_LONGS(bits) \ | 33 | #define BITS_TO_LONGS(bits) \ |
34 | (bits + (BITS_PER_LONG - 1) / BITS_PER_LONG) | 34 | (bits + (BITS_PER_LONG - 1) / BITS_PER_LONG) |
35 | 35 | ||
36 | #define BIT(i) (1ULL << (i)) | 36 | /* |
37 | * Deprecated; use the explicit BITxx() macros instead. | ||
38 | */ | ||
39 | #define BIT(i) BIT64(i) | ||
37 | 40 | ||
38 | #define GENMASK(h, l) \ | 41 | #define GENMASK(h, l) \ |
39 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) | 42 | (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) |