Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: tracing: Fix compile error in trace_array calls when TRACING is disabled

Fix this compilation error seen when CONFIG_TRACING is not enabled:

drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_init':
drivers/scsi/qla2xxx/qla_os.c:2854:25: error: implicit declaration of function
'trace_array_get_by_name'; did you mean 'trace_array_set_clr_event'?
[-Werror=implicit-function-declaration]
2854 | qla_trc_array = trace_array_get_by_name("qla2xxx");
| ^~~~~~~~~~~~~~~~~~~~~~~
| trace_array_set_clr_event

drivers/scsi/qla2xxx/qla_os.c: In function 'qla_trace_uninit':
drivers/scsi/qla2xxx/qla_os.c:2869:9: error: implicit declaration of function
'trace_array_put' [-Werror=implicit-function-declaration]
2869 | trace_array_put(qla_trc_array);
| ^~~~~~~~~~~~~~~

Link: https://lore.kernel.org/r/20220907233308.4153-2-aeasi@marvell.com
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Arun Easi and committed by
Martin K. Petersen
1a77dd1c 7f615c1b

+34 -2
+34 -2
include/linux/trace.h
··· 2 2 #ifndef _LINUX_TRACE_H 3 3 #define _LINUX_TRACE_H 4 4 5 - #ifdef CONFIG_TRACING 6 - 7 5 #define TRACE_EXPORT_FUNCTION BIT(0) 8 6 #define TRACE_EXPORT_EVENT BIT(1) 9 7 #define TRACE_EXPORT_MARKER BIT(2) ··· 26 28 int flags; 27 29 }; 28 30 31 + #ifdef CONFIG_TRACING 32 + 29 33 int register_ftrace_export(struct trace_export *export); 30 34 int unregister_ftrace_export(struct trace_export *export); 31 35 ··· 48 48 void osnoise_trace_irq_entry(int id); 49 49 void osnoise_trace_irq_exit(int id, const char *desc); 50 50 51 + #else /* CONFIG_TRACING */ 52 + static inline int register_ftrace_export(struct trace_export *export) 53 + { 54 + return -EINVAL; 55 + } 56 + static inline int unregister_ftrace_export(struct trace_export *export) 57 + { 58 + return 0; 59 + } 60 + static inline void trace_printk_init_buffers(void) 61 + { 62 + } 63 + static inline int trace_array_printk(struct trace_array *tr, unsigned long ip, 64 + const char *fmt, ...) 65 + { 66 + return 0; 67 + } 68 + static inline int trace_array_init_printk(struct trace_array *tr) 69 + { 70 + return -EINVAL; 71 + } 72 + static inline void trace_array_put(struct trace_array *tr) 73 + { 74 + } 75 + static inline struct trace_array *trace_array_get_by_name(const char *name) 76 + { 77 + return NULL; 78 + } 79 + static inline int trace_array_destroy(struct trace_array *tr) 80 + { 81 + return 0; 82 + } 51 83 #endif /* CONFIG_TRACING */ 52 84 53 85 #endif /* _LINUX_TRACE_H */