mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	tracing: Fix missing osnoise tracer on max_latency
The compiler warns when the data are actually unused:
  kernel/trace/trace.c:1712:13: error: ‘trace_create_maxlat_file’ defined but not used [-Werror=unused-function]
   1712 | static void trace_create_maxlat_file(struct trace_array *tr,
        |             ^~~~~~~~~~~~~~~~~~~~~~~~
[Why]
CONFIG_HWLAT_TRACER=n, CONFIG_TRACER_MAX_TRACE=n, CONFIG_OSNOISE_TRACER=y
gcc report warns.
[How]
Now trace_create_maxlat_file will only take effect when
CONFIG_HWLAT_TRACER=y or CONFIG_TRACER_MAX_TRACE=y. In fact, after
adding osnoise trace, it also needs to take effect.
Link: https://lore.kernel.org/all/c1d9e328-ad7c-920b-6c24-9e1598a6421c@infradead.org/
Link: https://lkml.kernel.org/r/20210922025122.3268022-1-liu.yun@linux.dev
Fixes: bce29ac9ce ("trace: Add osnoise tracer")
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
			
			
This commit is contained in:
		
							parent
							
								
									5816b3e657
								
							
						
					
					
						commit
						424b650f35
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		| 
						 | 
					@ -1744,16 +1744,15 @@ void latency_fsnotify(struct trace_array *tr)
 | 
				
			||||||
	irq_work_queue(&tr->fsnotify_irqwork);
 | 
						irq_work_queue(&tr->fsnotify_irqwork);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					#elif defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)	\
 | 
				
			||||||
 * (defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)) && \
 | 
						|| defined(CONFIG_OSNOISE_TRACER)
 | 
				
			||||||
 *  defined(CONFIG_FSNOTIFY)
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define trace_create_maxlat_file(tr, d_tracer)				\
 | 
					#define trace_create_maxlat_file(tr, d_tracer)				\
 | 
				
			||||||
	trace_create_file("tracing_max_latency", 0644, d_tracer,	\
 | 
						trace_create_file("tracing_max_latency", 0644, d_tracer,	\
 | 
				
			||||||
			  &tr->max_latency, &tracing_max_lat_fops)
 | 
								  &tr->max_latency, &tracing_max_lat_fops)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define trace_create_maxlat_file(tr, d_tracer)	 do { } while (0)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_TRACER_MAX_TRACE
 | 
					#ifdef CONFIG_TRACER_MAX_TRACE
 | 
				
			||||||
| 
						 | 
					@ -9473,9 +9472,7 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	create_trace_options_dir(tr);
 | 
						create_trace_options_dir(tr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
 | 
					 | 
				
			||||||
	trace_create_maxlat_file(tr, d_tracer);
 | 
						trace_create_maxlat_file(tr, d_tracer);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ftrace_create_function_files(tr, d_tracer))
 | 
						if (ftrace_create_function_files(tr, d_tracer))
 | 
				
			||||||
		MEM_FAIL(1, "Could not allocate function filter files");
 | 
							MEM_FAIL(1, "Could not allocate function filter files");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue