Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firewire: core: use macro expression for not-registered state of BUS_MANAGER_ID

The value of BUS_MANAGER_ID register has 0x3f when no node_id is
registered. Current implementation uses hard-coded numeric literal but
in the case the macro expression is preferable since it is easy to
distinguish the state from node ID mask.

This commit applies the idea.

Link: https://lore.kernel.org/r/20250913105737.778038-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

+11 -4
+8 -4
drivers/firewire/core-card.c
··· 327 327 * next generation. 328 328 */ 329 329 __be32 data[2] = { 330 - cpu_to_be32(0x3f), 330 + cpu_to_be32(BUS_MANAGER_ID_NOT_REGISTERED), 331 331 cpu_to_be32(local_id), 332 332 }; 333 333 struct fw_device *irm_device = fw_node_get_device(card->irm_node); ··· 372 372 if (rcode == RCODE_COMPLETE) { 373 373 int bm_id = be32_to_cpu(data[0]); 374 374 375 - if (generation == card->generation) 376 - card->bm_node_id = bm_id == 0x3f ? local_id : 0xffc0 | bm_id; 375 + if (generation == card->generation) { 376 + if (bm_id != BUS_MANAGER_ID_NOT_REGISTERED) 377 + card->bm_node_id = 0xffc0 & bm_id; 378 + else 379 + card->bm_node_id = local_id; 380 + } 377 381 378 - if (bm_id != 0x3f) { 382 + if (bm_id != BUS_MANAGER_ID_NOT_REGISTERED) { 379 383 spin_unlock_irq(&card->lock); 380 384 381 385 // Somebody else is BM. Only act as IRM.
+3
drivers/firewire/core.h
··· 170 170 171 171 /* -topology */ 172 172 173 + // The initial value of BUS_MANAGER_ID register, to express nothing registered. 174 + #define BUS_MANAGER_ID_NOT_REGISTERED 0x3f 175 + 173 176 enum { 174 177 FW_NODE_CREATED, 175 178 FW_NODE_UPDATED,