History

tracing: Fix compile error in module tracepoints when MODULE_UNLOAD not set

If modules are configured in the build but unloading of modules is not, then the refcnt is not defined. Place the get/put module tracepoints under CONFIG_MODULE_UNLOAD since it references this field in the module structure. As a side-effect, this patch also reduces the code when MODULE_UNLOAD is not set, because these unused tracepoints are not created.

Steven Rostedt committed 16 years ago

Commit eb0c5371 parent ae832d12 files · +7 −2Browse files

Unified · Split

2 files
  1. include/trace/events/module.h +4 −0
  2. kernel/module.c +3 −2
include/trace/events/module.h+4−0
@@ -51,6 +51,9 @@ TRACE_EVENT(module_free, · 50 unmodified lines
5151 TP_printk("%s", __get_str(name))
5252 );
5353
54+#ifdef CONFIG_MODULE_UNLOAD
55+/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */
56+
5457 DECLARE_EVENT_CLASS(module_refcnt,
5558
5659 TP_PROTO(struct module *mod, unsigned long ip),
@@ -86,6 +89,7 @@ DEFINE_EVENT(module_refcnt, module_put, · 29 unmodified lines
8689
8790 TP_ARGS(mod, ip)
8891 );
92+#endif /* CONFIG_MODULE_UNLOAD */
8993
9094 TRACE_EVENT(module_request,
9195
kernel/module.c+3−2
@@ -59,8 +59,6 @@ · 58 unmodified lines
5959 #define CREATE_TRACE_POINTS
6060 #include <trace/events/module.h>
6161
62−EXPORT_TRACEPOINT_SYMBOL(module_get);
63−
6462 #if 0
6563 #define DEBUGP printk
6664 #else
@@ -467,6 +465,9 @@ MODINFO_ATTR(srcversion); · 400 unmodified lines
467465 static char last_unloaded_module[MODULE_NAME_LEN+1];
468466
469467 #ifdef CONFIG_MODULE_UNLOAD
468+
469+EXPORT_TRACEPOINT_SYMBOL(module_get);
470+
470471 /* Init the unload section of the module. */
471472 static void module_unload_init(struct module *mod)
472473 {