summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2024-06-06 08:51:55 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2024-06-17 08:37:03 +0900
commit677ceae190732ee844f940d1e4860af4022d2be3 (patch)
tree1a9af11d8cf3712f3e4b6f24f2011e6e7893b13b /drivers
parent1ccfd1a4c809d99891142c1bb9851daa42e40f0d (diff)
downloadlinux-stable-677ceae190732ee844f940d1e4860af4022d2be3.tar.gz
linux-stable-677ceae190732ee844f940d1e4860af4022d2be3.tar.bz2
linux-stable-677ceae190732ee844f940d1e4860af4022d2be3.zip
firewire: core: add tracepoints event for self_id_sequence
It is helpful to trace the content of self ID sequence when the core function building bus topology. This commit adds a tracepoints event fot the purpose. It seems not to achieve printing variable length of array in print time without any storage, thus the structure of event includes a superfluous array to store the state of port. Additionally, there is no helper function to print symbol array, thus the state of port is printed as raw value. Link: https://lore.kernel.org/r/20240605235155.116468-12-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/core-topology.c7
-rw-r--r--drivers/firewire/core-trace.c15
2 files changed, 20 insertions, 2 deletions
diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c
index e17a01345857..04e24d14e031 100644
--- a/drivers/firewire/core-topology.c
+++ b/drivers/firewire/core-topology.c
@@ -95,7 +95,8 @@ static inline struct fw_node *fw_node(struct list_head *l)
* internally consistent. On success this function returns the
* fw_node corresponding to the local card otherwise NULL.
*/
-static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self_id_count)
+static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self_id_count,
+ unsigned int generation)
{
struct self_id_sequence_enumerator enumerator = {
.cursor = sid,
@@ -139,6 +140,8 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self
}
port_capacity = self_id_sequence_get_port_capacity(quadlet_count);
+ trace_self_id_sequence(self_id_sequence, quadlet_count, generation);
+
for (port_index = 0; port_index < port_capacity; ++port_index) {
port_status = self_id_sequence_get_port_status(self_id_sequence, quadlet_count,
port_index);
@@ -482,7 +485,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
card->bm_abdicate = bm_abdicate;
fw_schedule_bm_work(card, 0);
- local_node = build_tree(card, self_ids, self_id_count);
+ local_node = build_tree(card, self_ids, self_id_count, generation);
update_topology_map(card, self_ids, self_id_count);
diff --git a/drivers/firewire/core-trace.c b/drivers/firewire/core-trace.c
index 7cbf850f3719..c9bc4990d66e 100644
--- a/drivers/firewire/core-trace.c
+++ b/drivers/firewire/core-trace.c
@@ -2,7 +2,22 @@
// Copyright (c) 2024 Takashi Sakamoto
#include <linux/types.h>
+#include <linux/err.h>
#include "packet-header-definitions.h"
+#include "phy-packet-definitions.h"
#define CREATE_TRACE_POINTS
#include <trace/events/firewire.h>
+
+#ifdef TRACEPOINTS_ENABLED
+void copy_port_status(u8 *port_status, unsigned int port_capacity,
+ const u32 *self_id_sequence, unsigned int quadlet_count)
+{
+ unsigned int port_index;
+
+ for (port_index = 0; port_index < port_capacity; ++port_index) {
+ port_status[port_index] =
+ self_id_sequence_get_port_status(self_id_sequence, quadlet_count, port_index);
+ }
+}
+#endif