diff options
author | Amulya <Amurthyreddy@nvidia.com> | 2018-09-05 02:37:21 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-06 05:15:16 -0400 |
commit | 6227e003920ae3bdcf8b0731fbd342158378958a (patch) | |
tree | f8c901a85134e29e423fdf40403505e2b0fa5256 | |
parent | 2998ab4e0a0b19da1332b82d779bd17b4e284b38 (diff) |
gpu: nvgpu: Add BIT8() and BIT16() macros
Added BIT8() and BIT16() macros to bit-shift u8 and u16 respectively.
Change-Id: I5ca43165b0dcf3702a49bc5f5b120ad7a63b39a8
Signed-off-by: Amulya <Amurthyreddy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1813039
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Tested-by: Amulya Murthyreddy <amurthyreddy@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/bitops.h | 2 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/types.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/include/nvgpu/bitops.h b/drivers/gpu/nvgpu/include/nvgpu/bitops.h index 8760708e..b6666930 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/bitops.h +++ b/drivers/gpu/nvgpu/include/nvgpu/bitops.h | |||
@@ -27,6 +27,8 @@ | |||
27 | /* | 27 | /* |
28 | * Explicit sizes for bit definitions. Please use these instead of BIT(). | 28 | * Explicit sizes for bit definitions. Please use these instead of BIT(). |
29 | */ | 29 | */ |
30 | #define BIT8(i) (U8(1) << (i)) | ||
31 | #define BIT16(i) (U16(1) << (i)) | ||
30 | #define BIT32(i) (U32(1) << (i)) | 32 | #define BIT32(i) (U32(1) << (i)) |
31 | #define BIT64(i) (U64(1) << (i)) | 33 | #define BIT64(i) (U64(1) << (i)) |
32 | 34 | ||
diff --git a/drivers/gpu/nvgpu/include/nvgpu/types.h b/drivers/gpu/nvgpu/include/nvgpu/types.h index dfa95557..8320721b 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/types.h +++ b/drivers/gpu/nvgpu/include/nvgpu/types.h | |||
@@ -55,6 +55,8 @@ | |||
55 | * overflows the 32 bit data type. So in this case we need an explicit cast to | 55 | * overflows the 32 bit data type. So in this case we need an explicit cast to |
56 | * 64 bits in order to prevent undefined behavior. | 56 | * 64 bits in order to prevent undefined behavior. |
57 | */ | 57 | */ |
58 | #define U8(x) ((u8)(x)) | ||
59 | #define U16(x) ((u16)(x)) | ||
58 | #define U32(x) ((u32)(x)) | 60 | #define U32(x) ((u32)(x)) |
59 | #define U64(x) ((u64)(x)) | 61 | #define U64(x) ((u64)(x)) |
60 | 62 | ||