mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 02:52:51 +03:00
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 <akv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2111058 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include <nvgpu/types.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#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);
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user