From e154c1c007cbf435a8a4d690927c8abd5bf2aea7 Mon Sep 17 00:00:00 2001 From: ajesh Date: Fri, 3 May 2019 14:43:33 +0530 Subject: [PATCH] gpu: nvgpu: fix MISRA violations in bug unit MISRA rule 21.2 forbids the usage of identifier names which start with an underscore. Fix the violations of MISRA rule 21.2 in bug unit. Jira NVGPU-3139 Change-Id: I2670f3745d09069a4d36beec4291c795a08f1c49 Signed-off-by: ajesh Reviewed-on: https://git-master.nvidia.com/r/2111058 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/bug.h | 12 +++++++----- drivers/gpu/nvgpu/include/nvgpu/posix/sort.h | 2 +- drivers/gpu/nvgpu/libnvgpu-drv.export | 2 +- drivers/gpu/nvgpu/os/posix/bug.c | 10 +++++----- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h index 55d7647e0..eb80bcefa 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/bug.h @@ -26,7 +26,7 @@ #include #include -#define BUG() __bug("") +#define BUG() nvgpu_posix_bug("") #define BUG_ON(cond) \ do { \ if (cond) { \ @@ -34,8 +34,10 @@ } \ } while (false) -#define WARN(cond, msg, arg...) ((void) __warn(cond, msg, ##arg)) -#define WARN_ON(cond) ((void) __warn(cond, "")) +#define WARN(cond, msg, arg...) \ + ((void) nvgpu_posix_warn(cond, msg, ##arg)) +#define WARN_ON(cond) \ + ((void) nvgpu_posix_warn(cond, "")) #define WARN_ONCE(cond, msg, arg...) \ ({static bool warn_once_warned = false; \ @@ -48,8 +50,8 @@ void dump_stack(void); -void __bug(const char *fmt, ...) __attribute__ ((noreturn)); -bool __warn(bool cond, const char *fmt, ...); +void nvgpu_posix_bug(const char *fmt, ...) __attribute__ ((noreturn)); +bool nvgpu_posix_warn(bool cond, const char *fmt, ...); /* Provide a simple API for BUG() handling */ void bug_handler_register(jmp_buf *handler); diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h b/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h index 3e1648f77..6572c75eb 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/sort.h @@ -29,7 +29,7 @@ static void sort(void *base, size_t num, size_t size, int (*cmp)(const void *a, const void *b), void (*swap)(void *a, void *b, int n)) { - __bug("sort() not implemented yet!"); + nvgpu_posix_bug("sort() not implemented yet!"); } #endif /* NVGPU_POSIX_SORT_H */ diff --git a/drivers/gpu/nvgpu/libnvgpu-drv.export b/drivers/gpu/nvgpu/libnvgpu-drv.export index ca151fee2..d6456815f 100644 --- a/drivers/gpu/nvgpu/libnvgpu-drv.export +++ b/drivers/gpu/nvgpu/libnvgpu-drv.export @@ -1,6 +1,5 @@ # Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. -__bug __nvgpu_get_pte __nvgpu_log_dbg __nvgpu_log_msg @@ -125,6 +124,7 @@ nvgpu_pd_free nvgpu_pd_gpu_addr nvgpu_pd_offset_from_index nvgpu_pd_write +nvgpu_posix_bug nvgpu_posix_cleanup nvgpu_posix_enable_fault_injection nvgpu_posix_ffs diff --git a/drivers/gpu/nvgpu/os/posix/bug.c b/drivers/gpu/nvgpu/os/posix/bug.c index ec479cd23..33bd5f9e2 100644 --- a/drivers/gpu/nvgpu/os/posix/bug.c +++ b/drivers/gpu/nvgpu/os/posix/bug.c @@ -48,7 +48,7 @@ void bug_handler_cancel(void) jmp_handler = NULL; } -static void __dump_stack(int skip_frames) +static void nvgpu_posix_dump_stack(int skip_frames) { #ifndef _QNX_SOURCE void *trace[BACKTRACE_MAXSIZE]; @@ -67,14 +67,14 @@ static void __dump_stack(int skip_frames) void dump_stack(void) { - /* Skip this function and __dump_stack() */ - __dump_stack(2); + /* Skip this function and nvgpu_posix_dump_stack() */ + nvgpu_posix_dump_stack(2); } /* * Ahhh! A bug! */ -void __bug(const char *fmt, ...) +void nvgpu_posix_bug(const char *fmt, ...) { if (expect_bug) { nvgpu_info(NULL, "Expected BUG detected!"); @@ -92,7 +92,7 @@ void __bug(const char *fmt, ...) pthread_exit(NULL); } -bool __warn(bool cond, const char *fmt, ...) +bool nvgpu_posix_warn(bool cond, const char *fmt, ...) { if (!cond) { goto done;