[PATCH 4/6] firewire: core: use sparse annotations and lockdep checks for topology map lock

From: Takashi Sakamoto

Date: Thu Oct 08 2026 - 19:45:37 EST


The spinlock protects the topology map from concurrent access.

Add sparse annotations and lockdep checks for this lock.

Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/core-topology.c | 3 +++
drivers/firewire/core-transaction.c | 3 +++
2 files changed, 6 insertions(+)

diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c
index ee6b54f89859..512b7e4473af 100644
--- a/drivers/firewire/core-topology.c
+++ b/drivers/firewire/core-topology.c
@@ -474,9 +474,12 @@ static void update_topology_map(__be32 *buffer, size_t buffer_size, int root_nod

void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
int self_id_count, u32 *self_ids, bool bm_abdicate)
+__must_not_hold(&card->topology_map.lock)
{
struct fw_node *local_node;

+ lockdep_assert_not_held(&card->topology_map.lock);
+
trace_bus_reset_handle(card->index, generation, node_id, bm_abdicate, self_ids, self_id_count);

scoped_guard(spinlock, &card->lock) {
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 0c492e4af971..4dec03340ae6 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -1263,9 +1263,12 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
int tcode, int destination, int source, int generation,
unsigned long long offset, void *payload, size_t length,
void *callback_data)
+__must_not_hold(&card->topology_map.lock)
{
int start;

+ lockdep_assert_not_held(&card->topology_map.lock);
+
if (!tcode_is_read_request(tcode)) {
fw_send_response(card, request, RCODE_TYPE_ERROR);
return;
--
2.53.0