[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250908012108.514698-10-o-takashi@sakamocchi.jp>
Date: Mon, 8 Sep 2025 10:21:06 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH 09/11] firewire: core: code refactoring to detect both IEEE 1394:1995 IRM and Canon MV5i
The detection of IEEE 1394:1995 and Canon MV5i is just required within
some of the condition branches. In this case, these check can be
capsulated within these branches.
This commit refactors the checks.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/core-card.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
index 630e229c9cc2..99aa98f195ba 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -289,15 +289,13 @@ static void bm_work(struct work_struct *work)
63, 5, 7, 8, 10, 13, 16, 18, 21, 24, 26, 29, 32, 35, 37, 40
};
struct fw_card *card __free(card_unref) = from_work(card, work, bm_work.work);
- struct fw_device *root_device, *irm_device;
+ struct fw_device *root_device;
struct fw_node *root_node __free(node_unref) = NULL;
int root_id, new_root_id, irm_id, local_id;
int expected_gap_count, generation, grace;
bool do_reset = false;
bool root_device_is_running;
bool root_device_is_cmc;
- bool irm_is_1394_1995_only;
- bool keep_this_irm;
lockdep_assert_held(&card->lock);
@@ -316,14 +314,6 @@ static void bm_work(struct work_struct *work)
atomic_read(&root_device->state) == FW_DEVICE_RUNNING;
root_device_is_cmc = root_device && root_device->cmc;
- irm_device = fw_node_get_device(card->irm_node);
- irm_is_1394_1995_only = irm_device && irm_device->config_rom &&
- (irm_device->config_rom[2] & 0x000000f0) == 0;
-
- /* Canon MV5i works unreliably if it is not root node. */
- keep_this_irm = irm_device && irm_device->config_rom &&
- irm_device->config_rom[3] >> 8 == CANON_OUI;
-
root_id = root_node->node_id;
irm_id = card->irm_node->node_id;
local_id = card->local_node->node_id;
@@ -349,6 +339,9 @@ static void bm_work(struct work_struct *work)
cpu_to_be32(0x3f),
cpu_to_be32(local_id),
};
+ struct fw_device *irm_device = fw_node_get_device(card->irm_node);
+ bool irm_is_1394_1995_only = false;
+ bool keep_this_irm = false;
int rcode;
if (!card->irm_node->link_on) {
@@ -358,6 +351,13 @@ static void bm_work(struct work_struct *work)
goto pick_me;
}
+ if (irm_device && irm_device->config_rom) {
+ irm_is_1394_1995_only = (irm_device->config_rom[2] & 0x000000f0) == 0;
+
+ // Canon MV5i works unreliably if it is not root node.
+ keep_this_irm = irm_device->config_rom[3] >> 8 == CANON_OUI;
+ }
+
if (irm_is_1394_1995_only && !keep_this_irm) {
new_root_id = local_id;
fw_notice(card, "%s, making local node (%02x) root\n",
--
2.48.1
Powered by blists - more mailing lists