greybus: tracepoints: add tracepoint definitions
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Fri, 18 Sep 2015 15:38:44 +0000 (16:38 +0100)
committerGreg Kroah-Hartman <gregkh@google.com>
Fri, 18 Sep 2015 21:07:28 +0000 (14:07 -0700)
This patch adds greybus_trace.h with the following trace definitions

- trace_gb_message_send
- trace_gb_message_recv_request
- trace_gb_message_recv_response
- trace_gb_message_cancel_incoming
- trace_gb_message_cancel_outgoing

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_trace.h [new file with mode: 0644]

diff --git a/drivers/staging/greybus/greybus_trace.h b/drivers/staging/greybus/greybus_trace.h
new file mode 100644 (file)
index 0000000..abceb3a
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Greybus driver and device API
+ *
+ * Copyright 2015 Google Inc.
+ * Copyright 2015 Linaro Ltd.
+ *
+ * Released under the GPLv2 only.
+ */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM greybus
+
+#if !defined(_TRACE_GREYBUS_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_GREYBUS_H
+
+#include <linux/tracepoint.h>
+
+struct gb_message;
+
+DECLARE_EVENT_CLASS(gb_message,
+
+       TP_PROTO(struct gb_message *message),
+
+       TP_ARGS(message),
+
+       TP_STRUCT__entry(
+               __string(name, dev_name(&message->operation->connection->dev))
+               __field(u16, op_id)
+               __field(u16, intf_cport_id)
+               __field(u16, hd_cport_id)
+               __field(size_t, payload_size)
+       ),
+
+       TP_fast_assign(
+               __assign_str(name, dev_name(&message->operation->connection->dev))
+               __entry->op_id = message->operation->id;
+               __entry->intf_cport_id =
+                       message->operation->connection->intf_cport_id;
+               __entry->hd_cport_id =
+                       message->operation->connection->hd_cport_id;
+               __entry->payload_size = message->payload_size;
+       ),
+
+       TP_printk("greybus:%s op=%04x if_id=%04x hd_id=%04x l=%zu",
+                 __get_str(name), __entry->op_id, __entry->intf_cport_id,
+                 __entry->hd_cport_id, __entry->payload_size)
+);
+
+/*
+ * 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)
+);
+
+/*
+ * 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)
+);
+
+/*
+ * 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)
+);
+
+/*
+ * 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)
+);
+
+/*
+ * 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),
+
+       TP_ARGS(message)
+);
+
+#endif /* _TRACE_GREYBUS_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+/*
+ * TRACE_INCLUDE_FILE is not needed if the filename and TRACE_SYSTEM are equal
+ */
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE greybus_trace
+#include <trace/define_trace.h>
+