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.
Unified · Split
| @@ -51,6 +51,9 @@ TRACE_EVENT(module_free, · 50 unmodified lines | ||
| 51 | 51 | TP_printk("%s", __get_str(name)) |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | +#ifdef CONFIG_MODULE_UNLOAD | |
| 55 | +/* trace_module_get/put are only used if CONFIG_MODULE_UNLOAD is defined */ | |
| 56 | + | |
| 54 | 57 | DECLARE_EVENT_CLASS(module_refcnt, |
| 55 | 58 | |
| 56 | 59 | TP_PROTO(struct module *mod, unsigned long ip), |
| @@ -86,6 +89,7 @@ DEFINE_EVENT(module_refcnt, module_put, · 29 unmodified lines | ||
| 86 | 89 | |
| 87 | 90 | TP_ARGS(mod, ip) |
| 88 | 91 | ); |
| 92 | +#endif /* CONFIG_MODULE_UNLOAD */ | |
| 89 | 93 | |
| 90 | 94 | TRACE_EVENT(module_request, |
| 91 | 95 | |
| @@ -59,8 +59,6 @@ · 58 unmodified lines | ||
| 59 | 59 | #define CREATE_TRACE_POINTS |
| 60 | 60 | #include <trace/events/module.h> |
| 61 | 61 | |
| 62 | −EXPORT_TRACEPOINT_SYMBOL(module_get); | |
| 63 | − | |
| 64 | 62 | #if 0 |
| 65 | 63 | #define DEBUGP printk |
| 66 | 64 | #else |
| @@ -467,6 +465,9 @@ MODINFO_ATTR(srcversion); · 400 unmodified lines | ||
| 467 | 465 | static char last_unloaded_module[MODULE_NAME_LEN+1]; |
| 468 | 466 | |
| 469 | 467 | #ifdef CONFIG_MODULE_UNLOAD |
| 468 | + | |
| 469 | +EXPORT_TRACEPOINT_SYMBOL(module_get); | |
| 470 | + | |
| 470 | 471 | /* Init the unload section of the module. */ |
| 471 | 472 | static void module_unload_init(struct module *mod) |
| 472 | 473 | { |