]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
firewire: core: use macro expression for gap count mismatch
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 13 Sep 2025 10:57:36 +0000 (19:57 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 13 Sep 2025 10:59:21 +0000 (19:59 +0900)
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.

Link: https://lore.kernel.org/r/20250913105737.778038-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/core-card.c
drivers/firewire/core-topology.c
drivers/firewire/core.h

index 32cf6b3344cd902f2ada300768234ed100dda4f4..bf2e7f55b83e6088ec32c9cc2d169a03c70f9162 100644 (file)
@@ -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
index 74a6aa7d8cc92c785c98ff5a0552c17b851d26a0..5f8fb1201d80165ba90c3f0fcfcd358e20d30218 100644 (file)
@@ -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);
 
index 083e39034c378e2b26ca53c98373e7f0d2794fa3..79eb57fd5812ac12ded78fc2697dac7a7bdab46b 100644 (file)
@@ -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)