From 6227e003920ae3bdcf8b0731fbd342158378958a Mon Sep 17 00:00:00 2001 From: Amulya Date: Wed, 5 Sep 2018 12:07:21 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1813039 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Tested-by: Amulya Murthyreddy Reviewed-by: Adeel Raza Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/bitops.h | 2 ++ drivers/gpu/nvgpu/include/nvgpu/types.h | 2 ++ 2 files changed, 4 insertions(+) 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 @@ /* * Explicit sizes for bit definitions. Please use these instead of BIT(). */ +#define BIT8(i) (U8(1) << (i)) +#define BIT16(i) (U16(1) << (i)) #define BIT32(i) (U32(1) << (i)) #define BIT64(i) (U64(1) << (i)) 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 @@ * overflows the 32 bit data type. So in this case we need an explicit cast to * 64 bits in order to prevent undefined behavior. */ +#define U8(x) ((u8)(x)) +#define U16(x) ((u16)(x)) #define U32(x) ((u32)(x)) #define U64(x) ((u64)(x)) -- cgit v1.2.2