qcacmn: Add conditional macro for tracing threads

Kernel 5.2 has removed the stack_trace struct and replaced
print_stack_trace() and save_stack_trace_tsk() with stack_trace_print()
and stack_trace_save_tsk() respectively. Add a conditional preprocessor
directive to use save_trace_print() and stack_trace_save_tsk() and call
them with the appropriate updated parameters.

Change-Id: I99643e1b93251de7453f511d13f5a4a39c56f99c
CRs-Fixed: 2559033
This commit is contained in:
Alan Chen
2019-11-14 10:44:00 -08:00
committed by nshrivas
parent 507b75ac5c
commit 2a25844f08

View File

@@ -192,6 +192,21 @@ qdf_export_symbol(qdf_wake_up_process);
defined(BACKPORTED_EXPORT_SAVE_STACK_TRACE_TSK_ARM)) && \
defined(CONFIG_STACKTRACE)
#define QDF_PRINT_TRACE_COUNT 32
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0))
void qdf_print_thread_trace(qdf_thread_t *thread)
{
const int spaces = 4;
struct task_struct *task = thread;
unsigned long entries[QDF_PRINT_TRACE_COUNT] = {0};
unsigned int nr_entries;
unsigned int max_entries = QDF_PRINT_TRACE_COUNT;
int skip = 0;
nr_entries = stack_trace_save_tsk(task, entries, max_entries, skip);
stack_trace_print(entries, nr_entries, spaces);
}
#else
void qdf_print_thread_trace(qdf_thread_t *thread)
{
const int spaces = 4;
@@ -207,6 +222,8 @@ void qdf_print_thread_trace(qdf_thread_t *thread)
save_stack_trace_tsk(task, &trace);
print_stack_trace(&trace, spaces);
}
#endif
#else
void qdf_print_thread_trace(qdf_thread_t *thread) { }
#endif /* KERNEL_VERSION(4, 14, 0) */