From 6e9fdd57eb4d82cec1701b8dbf5f06c183ac273a Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 10 May 2019 11:16:25 -0700 Subject: [PATCH] gpu: nvgpu: fix MISRA 21.x violations in utils Below MISRA 21.1 violation is reported in nvgpu.common.utils ${TEGRA_TOP}/kernel/nvgpu/drivers/gpu/nvgpu/include/nvgpu/utils.h:56: misra_violation: The NVGPU_GET_IP shall not be defined or undefined. Below MISRA 21.2 violation is reported in nvgpu.common.utils ${TEGRA_TOP}/kernel/nvgpu/drivers/gpu/nvgpu/include/nvgpu/utils.h:56: misra_violation: The NVGPU_GET_IP shall not be declared. Fix this by renaming _NVGPU_GET_IP_ to NVGPU_GET_IP Jira NVGPU-3327 Change-Id: Ied94d8c8d80c2b26df8e742c18255c3dc657d59a Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2116696 GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan Reviewed-by: Seema Khowala Reviewed-by: Vinod Gopalakrishnakurup Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/kmem.h | 10 +++++----- drivers/gpu/nvgpu/include/nvgpu/timers.h | 4 ++-- drivers/gpu/nvgpu/include/nvgpu/utils.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/kmem.h b/drivers/gpu/nvgpu/include/nvgpu/kmem.h index d4ddf86c3..fb1424742 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/kmem.h +++ b/drivers/gpu/nvgpu/include/nvgpu/kmem.h @@ -117,7 +117,7 @@ void nvgpu_kmem_cache_free(struct nvgpu_kmem_cache *cache, void *ptr); * * This function may sleep so cannot be used in IRQs. */ -#define nvgpu_kmalloc(g, size) nvgpu_kmalloc_impl(g, size, _NVGPU_GET_IP_) +#define nvgpu_kmalloc(g, size) nvgpu_kmalloc_impl(g, size, NVGPU_GET_IP) /** * nvgpu_kzalloc - Allocate from the kernel's allocator. @@ -128,7 +128,7 @@ void nvgpu_kmem_cache_free(struct nvgpu_kmem_cache *cache, void *ptr); * Identical to nvgpu_kalloc() except the memory will be zeroed before being * returned. */ -#define nvgpu_kzalloc(g, size) nvgpu_kzalloc_impl(g, size, _NVGPU_GET_IP_) +#define nvgpu_kzalloc(g, size) nvgpu_kzalloc_impl(g, size, NVGPU_GET_IP) /** * nvgpu_kcalloc - Allocate from the kernel's allocator. @@ -141,7 +141,7 @@ void nvgpu_kmem_cache_free(struct nvgpu_kmem_cache *cache, void *ptr); * @n * @size. */ #define nvgpu_kcalloc(g, n, size) \ - nvgpu_kcalloc_impl(g, n, size, _NVGPU_GET_IP_) + nvgpu_kcalloc_impl(g, n, size, NVGPU_GET_IP) /** * nvgpu_vmalloc - Allocate memory and return a map to it. @@ -157,7 +157,7 @@ void nvgpu_kmem_cache_free(struct nvgpu_kmem_cache *cache, void *ptr); * * This function may sleep. */ -#define nvgpu_vmalloc(g, size) nvgpu_vmalloc_impl(g, size, _NVGPU_GET_IP_) +#define nvgpu_vmalloc(g, size) nvgpu_vmalloc_impl(g, size, NVGPU_GET_IP) /** * nvgpu_vzalloc - Allocate memory and return a map to it. @@ -167,7 +167,7 @@ void nvgpu_kmem_cache_free(struct nvgpu_kmem_cache *cache, void *ptr); * * Identical to nvgpu_vmalloc() except this will return zero'ed memory. */ -#define nvgpu_vzalloc(g, size) nvgpu_vzalloc_impl(g, size, _NVGPU_GET_IP_) +#define nvgpu_vzalloc(g, size) nvgpu_vzalloc_impl(g, size, NVGPU_GET_IP) /** * nvgpu_kfree - Frees an alloc from nvgpu_kmalloc, nvgpu_kzalloc, diff --git a/drivers/gpu/nvgpu/include/nvgpu/timers.h b/drivers/gpu/nvgpu/include/nvgpu/timers.h index 684665b7d..fcde49169 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/timers.h +++ b/drivers/gpu/nvgpu/include/nvgpu/timers.h @@ -86,10 +86,10 @@ int nvgpu_timeout_init(struct gk20a *g, struct nvgpu_timeout *timeout, int nvgpu_timeout_peek_expired(struct nvgpu_timeout *timeout); #define nvgpu_timeout_expired(__timeout) \ - nvgpu_timeout_expired_msg_impl(__timeout, _NVGPU_GET_IP_, "") + nvgpu_timeout_expired_msg_impl(__timeout, NVGPU_GET_IP, "") #define nvgpu_timeout_expired_msg(__timeout, fmt, args...) \ - nvgpu_timeout_expired_msg_impl(__timeout, _NVGPU_GET_IP_, \ + nvgpu_timeout_expired_msg_impl(__timeout, NVGPU_GET_IP, \ fmt, ##args) /* diff --git a/drivers/gpu/nvgpu/include/nvgpu/utils.h b/drivers/gpu/nvgpu/include/nvgpu/utils.h index 6184608a7..2e96e29d1 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/utils.h +++ b/drivers/gpu/nvgpu/include/nvgpu/utils.h @@ -53,6 +53,6 @@ static inline u32 get_field(u32 reg, u32 mask) /* * MISRA Rule 11.6 compliant IP address generator. */ -#define _NVGPU_GET_IP_ ({ __label__ __here; __here: &&__here; }) +#define NVGPU_GET_IP ({ __label__ __here; __here: &&__here; }) #endif /* NVGPU_UTILS_H */