]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/marker.h
Merge branch 'fix/hda' into topic/hda
[linux-2.6-omap-h63xx.git] / include / linux / marker.h
index 57a307018cebb102f12a7326580e166a151be336..b85e74ca782ff1fb026732717ffa8db5d688a1d9 100644 (file)
@@ -55,6 +55,22 @@ struct marker {
 
 #ifdef CONFIG_MARKERS
 
+#define _DEFINE_MARKER(name, tp_name_str, tp_cb, format)               \
+               static const char __mstrtab_##name[]                    \
+               __attribute__((section("__markers_strings")))           \
+               = #name "\0" format;                                    \
+               static struct marker __mark_##name                      \
+               __attribute__((section("__markers"), aligned(8))) =     \
+               { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)],   \
+                 0, 0, marker_probe_cb, { __mark_empty_function, NULL},\
+                 NULL, tp_name_str, tp_cb }
+
+#define DEFINE_MARKER(name, format)                                    \
+               _DEFINE_MARKER(name, NULL, NULL, format)
+
+#define DEFINE_MARKER_TP(name, tp_name, tp_cb, format)                 \
+               _DEFINE_MARKER(name, #tp_name, tp_cb, format)
+
 /*
  * Note : the empty asm volatile with read constraint is used here instead of a
  * "used" attribute to fix a gcc 4.1.x bug.
@@ -68,14 +84,7 @@ struct marker {
  */
 #define __trace_mark(generic, name, call_private, format, args...)     \
        do {                                                            \
-               static const char __mstrtab_##name[]                    \
-               __attribute__((section("__markers_strings")))           \
-               = #name "\0" format;                                    \
-               static struct marker __mark_##name                      \
-               __attribute__((section("__markers"), aligned(8))) =     \
-               { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)],   \
-               0, 0, marker_probe_cb,                                  \
-               { __mark_empty_function, NULL}, NULL, NULL, NULL };     \
+               DEFINE_MARKER(name, format);                            \
                __mark_check_format(format, ## args);                   \
                if (unlikely(__mark_##name.state)) {                    \
                        (*__mark_##name.call)                           \
@@ -89,14 +98,7 @@ struct marker {
                {                                                       \
                        register_trace_##tp_name(tp_cb);                \
                }                                                       \
-               static const char __mstrtab_##name[]                    \
-               __attribute__((section("__markers_strings")))           \
-               = #name "\0" format;                                    \
-               static struct marker __mark_##name                      \
-               __attribute__((section("__markers"), aligned(8))) =     \
-               { __mstrtab_##name, &__mstrtab_##name[sizeof(#name)],   \
-               0, 0, marker_probe_cb,                                  \
-               { __mark_empty_function, NULL}, NULL, #tp_name, tp_cb };\
+               DEFINE_MARKER_TP(name, tp_name, tp_cb, format);         \
                __mark_check_format(format, ## args);                   \
                (*__mark_##name.call)(&__mark_##name, call_private,     \
                                        ## args);                       \
@@ -104,7 +106,11 @@ struct marker {
 
 extern void marker_update_probe_range(struct marker *begin,
        struct marker *end);
+
+#define GET_MARKER(name)       (__mark_##name)
+
 #else /* !CONFIG_MARKERS */
+#define DEFINE_MARKER(name, tp_name, tp_cb, format)
 #define __trace_mark(generic, name, call_private, format, args...) \
                __mark_check_format(format, ## args)
 #define __trace_mark_tp(name, call_private, tp_name, tp_cb, format, args...) \
@@ -118,6 +124,7 @@ extern void marker_update_probe_range(struct marker *begin,
 static inline void marker_update_probe_range(struct marker *begin,
        struct marker *end)
 { }
+#define GET_MARKER(name)
 #endif /* CONFIG_MARKERS */
 
 /**
@@ -204,8 +211,10 @@ extern void *marker_get_private_data(const char *name, marker_probe_func *probe,
 
 /*
  * marker_synchronize_unregister must be called between the last marker probe
- * unregistration and the end of module exit to make sure there is no caller
- * executing a probe when it is freed.
+ * unregistration and the first one of
+ * - the end of module exit function
+ * - the free of any resource used by the probes
+ * to ensure the code and data are valid for any possibly running probes.
  */
 #define marker_synchronize_unregister() synchronize_sched()