mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: fix MISRA 17.1 in logging functions
MISRA Rule 17.1 forbids use of stdarg.h features which are defined for variable arguments. This patch modifies logging macros to use slogf function for QNX builds. This avoids use of variable argument functions used for formatting log message. Jira NVGPU-4075 Change-Id: I5b6bb1107a7e431afaa960003858193a477b2ee6 Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2192016 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
7a62265dde
commit
7c98fbba42
@@ -42,31 +42,44 @@ int nvgpu_current_tid(struct gk20a *g)
|
||||
void nvgpu_print_current_impl(struct gk20a *g, const char *func_name, int line,
|
||||
void *ctx, enum nvgpu_log_type type)
|
||||
{
|
||||
char *log_message = "(unknown process)";
|
||||
|
||||
#if defined(__NVGPU_POSIX__)
|
||||
#ifdef _GNU_SOURCE
|
||||
char current_tname[CURRENT_NAME_LEN];
|
||||
|
||||
/* pthread_getname_np() will return null terminated string on success */
|
||||
if (pthread_getname_np(0, current_tname, CURRENT_NAME_LEN) == 0) {
|
||||
nvgpu_log_msg_impl(g, func_name, line, type, "%s",
|
||||
current_tname);
|
||||
} else {
|
||||
nvgpu_log_msg_impl(g, func_name, line, type,
|
||||
"(unknown process)");
|
||||
log_message = current_tname;
|
||||
}
|
||||
#else
|
||||
nvgpu_log_msg_impl(g, func_name, line, type, "(unknown process)");
|
||||
nvgpu_err(g, "(unknown process)");
|
||||
return;
|
||||
#endif
|
||||
#else
|
||||
char current_tname[CURRENT_NAME_LEN];
|
||||
|
||||
/* pthread_getname_np() will return null terminated string on success */
|
||||
if (pthread_getname_np(0, current_tname, CURRENT_NAME_LEN) == 0) {
|
||||
nvgpu_log_msg_impl(g, func_name, line, type, "%s",
|
||||
current_tname);
|
||||
} else {
|
||||
nvgpu_log_msg_impl(g, func_name, line, type,
|
||||
"(unknown process)");
|
||||
log_message = current_tname;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (type) {
|
||||
case NVGPU_ERROR:
|
||||
nvgpu_err(g, "%s", log_message);
|
||||
break;
|
||||
case NVGPU_WARNING:
|
||||
nvgpu_warn(g, "%s", log_message);
|
||||
break;
|
||||
case NVGPU_DEBUG:
|
||||
nvgpu_log(g, 0U, "%s", log_message);
|
||||
break;
|
||||
case NVGPU_INFO:
|
||||
nvgpu_info(g, "%s", log_message);
|
||||
break;
|
||||
default:
|
||||
nvgpu_err(g, "%s", log_message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user