Skip to content

Commit eb0c537

Browse files
Steven Rostedtrostedt
authored andcommitted
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. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent ae832d1 commit eb0c537

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎include/trace/events/module.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ TRACE_EVENT(module_free,
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,
8689

8790
TP_ARGS(mod, ip)
8891
);
92+
#endif /* CONFIG_MODULE_UNLOAD */
8993

9094
TRACE_EVENT(module_request,
9195

‎kernel/module.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
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);
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
{

0 commit comments

Comments
 (0)