Skip to contentSkip to conversation

tracing: cleanup trace event macro

PATCH New Wei Yang 1 participant 5 messages Jun 12, 2020 Tracing

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

cover tracing: cleanup trace event macro

TRACE_EVENT definition is some kind of magic. We define/un-define some elements to implement it.

During the code reading, I found there are some redundant definition of the macro. Let's reform and remove some of them.

Wei Yang (4):
tracing: not necessary to undefine DEFINE_EVENT again
tracing: not necessary re-define DEFINE_EVENT_PRINT
tracing: define DEFINE_EVENT_PRINT not related to DEFINE_EVENT
tracing: not necessary to define DEFINE_EVENT_PRINT to be empty again

 include/trace/trace_events.h | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
Signature · 1 line
2.20.1 (Apple Git-117)
author
#1 lore raw

PATCH 1/4 tracing: not necessary to undefine DEFINE_EVENT again

After un-define DEFINE_EVENT in Stage 2, DEFINE_EVENT is not defined to a specific form. It is not necessary to un-define it again.

Let's skip this.

---
 include/trace/trace_events.h | 6 ------
 1 file changed, 6 deletions(-)
include/trace/trace_events.h +0 -6
index 502c7be50b8d..a4994761bdaf 100644
@@ -443,9 +443,6 @@ static struct trace_event_fields trace_event_fields_##call[] = {	\
 	tstruct								\
 	{} };
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(template, name, proto, args)
-
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
 	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
@@ -523,9 +520,6 @@ static inline notrace int trace_event_get_offsets_##call(		\
 	return __data_size;						\
 }
 
-#undef DEFINE_EVENT
-#define DEFINE_EVENT(template, name, proto, args)
-
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
 	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
Signature · 1 line
2.20.1 (Apple Git-117)
author
#2 lore raw

PATCH 2/4 tracing: not necessary re-define DEFINE_EVENT_PRINT

In reply to Wei Yang

The definition of DEFINE_EVENT_PRINT is not changed after previous one, so not necessary to re-define is as the same form.

---
 include/trace/trace_events.h | 4 ----
 1 file changed, 4 deletions(-)
include/trace/trace_events.h +0 -4
index a4994761bdaf..5219f81b9d74 100644
@@ -520,10 +520,6 @@ static inline notrace int trace_event_get_offsets_##call(		\
 	return __data_size;						\
 }
 
-#undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
-	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
-
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
 /*
Signature · 1 line
2.20.1 (Apple Git-117)
author
#3 lore raw

PATCH 3/4 tracing: define DEFINE_EVENT_PRINT not related to DEFINE_EVENT

In reply to Wei Yang

Current definition define DEFINE_EVENT_PRINT to be DEFINE_EVENT. Actually, at this point DEFINE_EVENT is already an empty macro. Let's cut the relationship between DEFINE_EVENT_PRINT and DEFINE_EVENT.

---
 include/trace/trace_events.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
include/trace/trace_events.h +2 -4
index 5219f81b9d74..43023c3e9d74 100644
@@ -210,8 +210,7 @@ TRACE_MAKE_SYSTEM_STR();
 #define DEFINE_EVENT(template, name, proto, args)
 
 #undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
-	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
 
 #undef TRACE_EVENT_FLAGS
 #define TRACE_EVENT_FLAGS(event, flag)
@@ -444,8 +443,7 @@ static struct trace_event_fields trace_event_fields_##call[] = {	\
 	{} };
 
 #undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
-	DEFINE_EVENT(template, name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
 
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
Signature · 1 line
2.20.1 (Apple Git-117)
author
#4 lore raw

PATCH 4/4 tracing: not necessary to define DEFINE_EVENT_PRINT to be empty again

In reply to Wei Yang

After the previous cleanup, DEFINE_EVENT_PRINT's definition has no relationship with DEFINE_EVENT. So After we re-define DEFINE_EVENT, it is not necessary to define DEFINE_EVENT_PRINT to be empty again.

---
 include/trace/trace_events.h | 3 ---
 1 file changed, 3 deletions(-)
include/trace/trace_events.h +0 -3
index 43023c3e9d74..1bc3e7bba9a4 100644
@@ -709,9 +709,6 @@ static inline void ftrace_test_probe_##call(void)			\
 	check_trace_callback_type_##call(trace_event_raw_event_##template); \
 }
 
-#undef DEFINE_EVENT_PRINT
-#define DEFINE_EVENT_PRINT(template, name, proto, args, print)
-
 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
 
 #undef __entry
Signature · 1 line
2.20.1 (Apple Git-117)