[RFC PATCH 09/13] firewire: core: add support for Linux kernel tracepoints

From: Takashi Sakamoto
Date: Thu Apr 18 2024 - 05:24:55 EST


The Linux Kernel Tracepoints framework is enough useful to trace
packet data inbound to and outbound from core.

This commit adds firewire subsystem to use the framework.

Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/Makefile | 5 ++++-
drivers/firewire/trace.c | 5 +++++
drivers/firewire/trace.h | 17 +++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 drivers/firewire/trace.c
create mode 100644 drivers/firewire/trace.h

diff --git a/drivers/firewire/Makefile b/drivers/firewire/Makefile
index bbde29a0fba6..92376e045805 100644
--- a/drivers/firewire/Makefile
+++ b/drivers/firewire/Makefile
@@ -3,12 +3,15 @@
# Makefile for the Linux IEEE 1394 implementation
#

-firewire-core-y += core-card.o core-cdev.o core-device.o \
+firewire-core-y += trace.o core-card.o core-cdev.o core-device.o \
core-iso.o core-topology.o core-transaction.o
firewire-ohci-y += ohci.o
firewire-sbp2-y += sbp2.o
firewire-net-y += net.o

+# Let "include/trace/define_trace.h" find the header.
+CFLAGS_trace.o := -I$(src)
+
obj-$(CONFIG_FIREWIRE) += firewire-core.o
obj-$(CONFIG_FIREWIRE_OHCI) += firewire-ohci.o
obj-$(CONFIG_FIREWIRE_SBP2) += firewire-sbp2.o
diff --git a/drivers/firewire/trace.c b/drivers/firewire/trace.c
new file mode 100644
index 000000000000..ffe427764a90
--- /dev/null
+++ b/drivers/firewire/trace.c
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright (c) 2024 Takashi Sakamoto
+
+#define CREATE_TRACE_POINTS
+#include "trace.h"
diff --git a/drivers/firewire/trace.h b/drivers/firewire/trace.h
new file mode 100644
index 000000000000..d36a10460301
--- /dev/null
+++ b/drivers/firewire/trace.h
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+// Copyright (c) 2024 Takashi Sakamoto
+
+#define TRACE_SYSTEM firewire
+
+#if !defined(_FIREWIRE_TRACE_EVENT_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _FIREWIRE_TRACE_EVENT_H
+
+#include <linux/tracepoint.h>
+
+// Placeholder for future use.
+
+#endif // _FIREWIRE_TRACE_EVENT_H
+
+#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_FILE trace
+#include <trace/define_trace.h>
--
2.43.0