]> git.karo-electronics.de Git - linux-beck.git/commitdiff
greybus: tracing: define events using macros
authorAlex Elder <elder@linaro.org>
Fri, 20 May 2016 16:44:55 +0000 (11:44 -0500)
committerGreg Kroah-Hartman <gregkh@google.com>
Sat, 21 May 2016 00:19:03 +0000 (17:19 -0700)
A tracepoint event is defined with TP_PROTO() and TP_ARGS macros
that match that of the event's class.  A lot of repetition (and
opportunity for inadvertent errors) in tracepoint event definitions
can be eliminated by using a macro.  Define and use class-specific
event definition macros for gb_message and gb_host_device class
events.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_trace.h

index 3b4875d91c32f324879d914adab1820cfcaabbc4..40c24cf9ba7ae86dcb93aae95d0cfad1e6bfb203 100644 (file)
@@ -52,65 +52,47 @@ DECLARE_EVENT_CLASS(gb_message,
                  __entry->hd_cport_id, __entry->payload_size)
 );
 
+#define DEFINE_MESSAGE_EVENT(name)                                     \
+               DEFINE_EVENT(gb_message, name,                          \
+                               TP_PROTO(struct gb_message *message),   \
+                               TP_ARGS(message))
+
 /*
  * tracepoint name     greybus:gb_message_send
  * description         send a greybus message
  * location            operation.c:gb_message_send
  */
-DEFINE_EVENT(gb_message, gb_message_send,
-
-       TP_PROTO(struct gb_message *message),
-
-       TP_ARGS(message)
-);
+DEFINE_MESSAGE_EVENT(gb_message_send);
 
 /*
  * tracepoint name     greybus:gb_message_recv_request
  * description         receive a greybus request
  * location            operation.c:gb_connection_recv_request
  */
-DEFINE_EVENT(gb_message, gb_message_recv_request,
-
-       TP_PROTO(struct gb_message *message),
-
-       TP_ARGS(message)
-);
+DEFINE_MESSAGE_EVENT(gb_message_recv_request);
 
 /*
  * tracepoint name     greybus:gb_message_recv_response
  * description         receive a greybus response
  * location            operation.c:gb_connection_recv_response
  */
-DEFINE_EVENT(gb_message, gb_message_recv_response,
-
-       TP_PROTO(struct gb_message *message),
-
-       TP_ARGS(message)
-);
+DEFINE_MESSAGE_EVENT(gb_message_recv_response);
 
 /*
  * tracepoint name     greybus:gb_message_cancel_outgoing
  * description         cancel outgoing greybus request
  * location            operation.c:gb_message_cancel
  */
-DEFINE_EVENT(gb_message, gb_message_cancel_outgoing,
-
-       TP_PROTO(struct gb_message *message),
-
-       TP_ARGS(message)
-);
+DEFINE_MESSAGE_EVENT(gb_message_cancel_outgoing);
 
 /*
  * tracepoint name     greybus:gb_message_cancel_incoming
  * description         cancel incoming greybus request
  * location            operation.c:gb_message_cancel_incoming
  */
-DEFINE_EVENT(gb_message, gb_message_cancel_incoming,
-
-       TP_PROTO(struct gb_message *message),
+DEFINE_MESSAGE_EVENT(gb_message_cancel_incoming);
 
-       TP_ARGS(message)
-);
+#undef DEFINE_MESSAGE_EVENT
 
 DECLARE_EVENT_CLASS(gb_operation,
 
@@ -203,31 +185,28 @@ DECLARE_EVENT_CLASS(gb_host_device,
                  __entry->intf_cport_id, __entry->payload_size)
 );
 
+#define DEFINE_HD_EVENT(name)                                          \
+               DEFINE_EVENT(gb_host_device, name,                      \
+                               TP_PROTO(struct gb_host_device *hd,     \
+                                       u16 intf_cport_id,              \
+                                       size_t payload_size),           \
+                               TP_ARGS(hd, intf_cport_id, payload_size))
+
 /*
  * tracepoint name     greybus:gb_host_device_send
  * description         tracepoint representing the point data are transmitted
  * location            es2.c:message_send
  */
-DEFINE_EVENT(gb_host_device, gb_host_device_send,
-
-       TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
-                size_t payload_size),
-
-       TP_ARGS(hd, intf_cport_id, payload_size)
-);
+DEFINE_HD_EVENT(gb_host_device_send);
 
 /*
  * tracepoint name     greybus:gb_host_device_recv
  * description         tracepoint representing the point data are received
  * location            es2.c:cport_in_callback
  */
-DEFINE_EVENT(gb_host_device, gb_host_device_recv,
+DEFINE_HD_EVENT(gb_host_device_recv);
 
-       TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
-                size_t payload_size),
-
-       TP_ARGS(hd, intf_cport_id, payload_size)
-);
+#undef DEFINE_HD_EVENT
 
 #endif /* _TRACE_GREYBUS_H */