gpu: nvgpu: use also normal logging with TRACE_PRINTK

When CONFIG_GK20A_TRACE_PRINTK is set to support printing to ftrace log
instead of the normal kernel log, but log_trace from debugfs is not set,
fall back to normal kernel logging instead of not logging anything.

Change-Id: I553baed20a52108229dbcc5c63e8af4e1bcd1b30
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1674250
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Holtta
2018-03-13 13:29:46 +02:00
committed by mobile promotions
parent 07a9ceef77
commit 4826bddfc4

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -60,10 +60,8 @@ static inline const char *nvgpu_log_name(struct gk20a *g)
#ifdef CONFIG_GK20A_TRACE_PRINTK #ifdef CONFIG_GK20A_TRACE_PRINTK
static void __nvgpu_trace_printk_log(u32 trace, const char *gpu_name, static void __nvgpu_trace_printk_log(u32 trace, const char *gpu_name,
const char *func_name, int line, const char *func_name, int line,
enum nvgpu_log_type type, const char *log) const char *log_type, const char *log)
{ {
const char *log_type = log_types[type];
trace_printk(LOG_FMT, gpu_name, func_name, line, log_type, log); trace_printk(LOG_FMT, gpu_name, func_name, line, log_type, log);
} }
#endif #endif
@@ -73,14 +71,13 @@ static void __nvgpu_really_print_log(u32 trace, const char *gpu_name,
enum nvgpu_log_type type, const char *log) enum nvgpu_log_type type, const char *log)
{ {
const char *name = gpu_name ? gpu_name : ""; const char *name = gpu_name ? gpu_name : "";
const char *log_type = log_types[type];
#ifdef CONFIG_GK20A_TRACE_PRINTK #ifdef CONFIG_GK20A_TRACE_PRINTK
if (trace) if (trace)
return __nvgpu_trace_printk_log(trace, name, func_name, return __nvgpu_trace_printk_log(trace, name, func_name,
line, type, log); line, log_type, log);
#else #endif
const char *log_type = log_types[type];
switch (type) { switch (type) {
case NVGPU_DEBUG: case NVGPU_DEBUG:
/* /*
@@ -100,7 +97,6 @@ static void __nvgpu_really_print_log(u32 trace, const char *gpu_name,
pr_err(LOG_FMT, name, func_name, line, log_type, log); pr_err(LOG_FMT, name, func_name, line, log_type, log);
break; break;
} }
#endif
} }
__attribute__((format (printf, 5, 6))) __attribute__((format (printf, 5, 6)))