Commit 2ba08d1b authored by Takashi Sakamoto's avatar Takashi Sakamoto
Browse files

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: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
parent 91bf158f
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -327,7 +327,7 @@ static void bm_work(struct work_struct *work)
		 * next generation.
		 */
		__be32 data[2] = {
			cpu_to_be32(0x3f),
			cpu_to_be32(BUS_MANAGER_ID_NOT_REGISTERED),
			cpu_to_be32(local_id),
		};
		struct fw_device *irm_device = fw_node_get_device(card->irm_node);
@@ -372,10 +372,14 @@ static void bm_work(struct work_struct *work)
		if (rcode == RCODE_COMPLETE) {
			int bm_id = be32_to_cpu(data[0]);

			if (generation == card->generation)
				card->bm_node_id = bm_id == 0x3f ? local_id : 0xffc0 | bm_id;
			if (generation == card->generation) {
				if (bm_id != BUS_MANAGER_ID_NOT_REGISTERED)
					card->bm_node_id = 0xffc0 & bm_id;
				else
					card->bm_node_id = local_id;
			}

			if (bm_id != 0x3f) {
			if (bm_id != BUS_MANAGER_ID_NOT_REGISTERED) {
				spin_unlock_irq(&card->lock);

				// Somebody else is BM.  Only act as IRM.
+3 −0
Original line number Diff line number Diff line
@@ -170,6 +170,9 @@ static inline void fw_iso_context_init_work(struct fw_iso_context *ctx, work_fun

/* -topology */

// The initial value of BUS_MANAGER_ID register, to express nothing registered.
#define BUS_MANAGER_ID_NOT_REGISTERED	0x3f

enum {
	FW_NODE_CREATED,
	FW_NODE_UPDATED,