[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250913105737.778038-2-o-takashi@sakamocchi.jp>
Date: Sat, 13 Sep 2025 19:57:36 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] firewire: core: use macro expression for gap count mismatch
The gap_count field is assigned to zero when mismatch is detected. In such
case, the macro expression is preferable since it is easy to understand
the situation.
This commit applies the idea.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/core-card.c | 2 +-
drivers/firewire/core-topology.c | 2 +-
drivers/firewire/core.h | 3 +++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index 32cf6b3344cd..bf2e7f55b83e 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -425,7 +425,7 @@ static void bm_work(struct work_struct *work)
*/
card->bm_generation = generation;
- if (card->gap_count == 0) {
+ if (card->gap_count == GAP_COUNT_MISMATCHED) {
/*
* If self IDs have inconsistent gap counts, do a
* bus reset ASAP. The config rom read might never
diff --git a/drivers/firewire/core-topology.c b/drivers/firewire/core-topology.c
index 74a6aa7d8cc9..5f8fb1201d80 100644
--- a/drivers/firewire/core-topology.c
+++ b/drivers/firewire/core-topology.c
@@ -241,7 +241,7 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self
// If PHYs report different gap counts, set an invalid count which will force a gap
// count reconfiguration and a reset.
if (phy_packet_self_id_zero_get_gap_count(self_id_sequence[0]) != gap_count)
- gap_count = 0;
+ gap_count = GAP_COUNT_MISMATCHED;
update_hop_count(node);
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
index 083e39034c37..79eb57fd5812 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -27,6 +27,9 @@ struct fw_packet;
/* -card */
+// This is the arbitrary value we use to indicate a mismatched gap count.
+#define GAP_COUNT_MISMATCHED 0
+
extern __printf(2, 3)
void fw_err(const struct fw_card *card, const char *fmt, ...);
extern __printf(2, 3)
--
2.48.1
Powered by blists - more mailing lists