mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
firewire: core; eliminate pick_me goto label
This commit uses condition statements instead of pick_me goto label. Link: https://lore.kernel.org/r/20250918235448.129705-6-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
This commit is contained in:
@@ -388,6 +388,7 @@ static void bm_work(struct work_struct *work)
|
|||||||
int root_id, new_root_id, irm_id, local_id;
|
int root_id, new_root_id, irm_id, local_id;
|
||||||
int expected_gap_count, generation;
|
int expected_gap_count, generation;
|
||||||
bool do_reset = false;
|
bool do_reset = false;
|
||||||
|
bool stand_for_root = false;
|
||||||
|
|
||||||
if (card->local_node == NULL)
|
if (card->local_node == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -408,11 +409,11 @@ static void bm_work(struct work_struct *work)
|
|||||||
fw_schedule_bm_work(card, msecs_to_jiffies(125));
|
fw_schedule_bm_work(card, msecs_to_jiffies(125));
|
||||||
return;
|
return;
|
||||||
case BM_CONTENTION_OUTCOME_IRM_HAS_LINK_OFF:
|
case BM_CONTENTION_OUTCOME_IRM_HAS_LINK_OFF:
|
||||||
new_root_id = local_id;
|
stand_for_root = true;
|
||||||
goto pick_me;
|
break;
|
||||||
case BM_CONTENTION_OUTCOME_IRM_COMPLIES_1394_1995_ONLY:
|
case BM_CONTENTION_OUTCOME_IRM_COMPLIES_1394_1995_ONLY:
|
||||||
new_root_id = local_id;
|
stand_for_root = true;
|
||||||
goto pick_me;
|
break;
|
||||||
case BM_CONTENTION_OUTCOME_AT_NEW_GENERATION:
|
case BM_CONTENTION_OUTCOME_AT_NEW_GENERATION:
|
||||||
// BM work has been rescheduled.
|
// BM work has been rescheduled.
|
||||||
return;
|
return;
|
||||||
@@ -423,8 +424,8 @@ static void bm_work(struct work_struct *work)
|
|||||||
return;
|
return;
|
||||||
case BM_CONTENTION_OUTCOME_IRM_IS_NOT_CAPABLE_FOR_IRM:
|
case BM_CONTENTION_OUTCOME_IRM_IS_NOT_CAPABLE_FOR_IRM:
|
||||||
// Let's do a bus reset and pick the local node as root, and thus, IRM.
|
// Let's do a bus reset and pick the local node as root, and thus, IRM.
|
||||||
new_root_id = local_id;
|
stand_for_root = true;
|
||||||
goto pick_me;
|
break;
|
||||||
case BM_CONTENTION_OUTCOME_IRM_HOLDS_ANOTHER_NODE_AS_BM:
|
case BM_CONTENTION_OUTCOME_IRM_HOLDS_ANOTHER_NODE_AS_BM:
|
||||||
if (local_id == irm_id) {
|
if (local_id == irm_id) {
|
||||||
// Only acts as IRM.
|
// Only acts as IRM.
|
||||||
@@ -438,26 +439,21 @@ static void bm_work(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// We're bus manager for this generation, so next step is to make sure we have an active
|
||||||
* We're bus manager for this generation, so next step is to
|
// cycle master and do gap count optimization.
|
||||||
* make sure we have an active cycle master and do gap count
|
if (!stand_for_root) {
|
||||||
* optimization.
|
|
||||||
*/
|
|
||||||
if (card->gap_count == GAP_COUNT_MISMATCHED) {
|
if (card->gap_count == GAP_COUNT_MISMATCHED) {
|
||||||
/*
|
// If self IDs have inconsistent gap counts, do a
|
||||||
* If self IDs have inconsistent gap counts, do a
|
// bus reset ASAP. The config rom read might never
|
||||||
* bus reset ASAP. The config rom read might never
|
// complete, so don't wait for it. However, still
|
||||||
* complete, so don't wait for it. However, still
|
// send a PHY configuration packet prior to the
|
||||||
* send a PHY configuration packet prior to the
|
// bus reset. The PHY configuration packet might
|
||||||
* bus reset. The PHY configuration packet might
|
// fail, but 1394-2008 8.4.5.2 explicitly permits
|
||||||
* fail, but 1394-2008 8.4.5.2 explicitly permits
|
// it in this case, so it should be safe to try.
|
||||||
* it in this case, so it should be safe to try.
|
stand_for_root = true;
|
||||||
*/
|
|
||||||
new_root_id = local_id;
|
// We must always send a bus reset if the gap count
|
||||||
/*
|
// is inconsistent, so bypass the 5-reset limit.
|
||||||
* We must always send a bus reset if the gap count
|
|
||||||
* is inconsistent, so bypass the 5-reset limit.
|
|
||||||
*/
|
|
||||||
card->bm_retries = 0;
|
card->bm_retries = 0;
|
||||||
} else {
|
} else {
|
||||||
// Now investigate root node.
|
// Now investigate root node.
|
||||||
@@ -466,7 +462,7 @@ static void bm_work(struct work_struct *work)
|
|||||||
if (root_device == NULL) {
|
if (root_device == NULL) {
|
||||||
// Either link_on is false, or we failed to read the
|
// Either link_on is false, or we failed to read the
|
||||||
// config rom. In either case, pick another root.
|
// config rom. In either case, pick another root.
|
||||||
new_root_id = local_id;
|
stand_for_root = true;
|
||||||
} else {
|
} else {
|
||||||
bool root_device_is_running =
|
bool root_device_is_running =
|
||||||
atomic_read(&root_device->state) == FW_DEVICE_RUNNING;
|
atomic_read(&root_device->state) == FW_DEVICE_RUNNING;
|
||||||
@@ -475,19 +471,24 @@ static void bm_work(struct work_struct *work)
|
|||||||
// If we haven't probed this device yet, bail out now
|
// If we haven't probed this device yet, bail out now
|
||||||
// and let's try again once that's done.
|
// and let's try again once that's done.
|
||||||
return;
|
return;
|
||||||
} else if (root_device->cmc) {
|
} else if (!root_device->cmc) {
|
||||||
// We will send out a force root packet for this
|
|
||||||
// node as part of the gap count optimization.
|
|
||||||
new_root_id = root_id;
|
|
||||||
} else {
|
|
||||||
// Current root has an active link layer and we
|
// Current root has an active link layer and we
|
||||||
// successfully read the config rom, but it's not
|
// successfully read the config rom, but it's not
|
||||||
// cycle master capable.
|
// cycle master capable.
|
||||||
|
stand_for_root = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stand_for_root) {
|
||||||
new_root_id = local_id;
|
new_root_id = local_id;
|
||||||
|
} else {
|
||||||
|
// We will send out a force root packet for this node as part of the gap count
|
||||||
|
// optimization on behalf of the node.
|
||||||
|
new_root_id = root_id;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
pick_me:
|
|
||||||
/*
|
/*
|
||||||
* Pick a gap count from 1394a table E-1. The table doesn't cover
|
* Pick a gap count from 1394a table E-1. The table doesn't cover
|
||||||
* the typically much larger 1394b beta repeater delays though.
|
* the typically much larger 1394b beta repeater delays though.
|
||||||
|
|||||||
Reference in New Issue
Block a user