Commit cf3cd61e authored by Jason Yan's avatar Jason Yan Committed by Martin K. Petersen

scsi: libsas: factor out sas_check_fanout_expander_topo()

To be consistent with sas_check_edge_expander_topo(), factor out
sas_check_fanout_expander_topo(). And remove the comment since we are not
spilling over 80 colums now.
Signed-off-by: default avatarJason Yan <yanaijie@huawei.com>
Link: https://lore.kernel.org/r/20230421093744.1583609-4-yanaijie@huawei.comReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ba9be7e7
...@@ -1271,11 +1271,25 @@ static int sas_check_edge_expander_topo(struct domain_device *child, ...@@ -1271,11 +1271,25 @@ static int sas_check_edge_expander_topo(struct domain_device *child,
return -ENODEV; return -ENODEV;
} }
/* Here we spill over 80 columns. It is intentional. static int sas_check_fanout_expander_topo(struct domain_device *child,
*/ struct ex_phy *parent_phy)
static int sas_check_parent_topology(struct domain_device *child)
{ {
struct expander_device *child_ex = &child->ex_dev; struct expander_device *child_ex = &child->ex_dev;
struct ex_phy *child_phy;
child_phy = &child_ex->ex_phy[parent_phy->attached_phy_id];
if (parent_phy->routing_attr == TABLE_ROUTING &&
child_phy->routing_attr == SUBTRACTIVE_ROUTING)
return 0;
sas_print_parent_topology_bug(child, parent_phy, child_phy);
return -ENODEV;
}
static int sas_check_parent_topology(struct domain_device *child)
{
struct expander_device *parent_ex; struct expander_device *parent_ex;
int i; int i;
int res = 0; int res = 0;
...@@ -1290,7 +1304,6 @@ static int sas_check_parent_topology(struct domain_device *child) ...@@ -1290,7 +1304,6 @@ static int sas_check_parent_topology(struct domain_device *child)
for (i = 0; i < parent_ex->num_phys; i++) { for (i = 0; i < parent_ex->num_phys; i++) {
struct ex_phy *parent_phy = &parent_ex->ex_phy[i]; struct ex_phy *parent_phy = &parent_ex->ex_phy[i];
struct ex_phy *child_phy;
if (parent_phy->phy_state == PHY_VACANT || if (parent_phy->phy_state == PHY_VACANT ||
parent_phy->phy_state == PHY_NOT_PRESENT) parent_phy->phy_state == PHY_NOT_PRESENT)
...@@ -1299,19 +1312,14 @@ static int sas_check_parent_topology(struct domain_device *child) ...@@ -1299,19 +1312,14 @@ static int sas_check_parent_topology(struct domain_device *child)
if (!sas_phy_match_dev_addr(child, parent_phy)) if (!sas_phy_match_dev_addr(child, parent_phy))
continue; continue;
child_phy = &child_ex->ex_phy[parent_phy->attached_phy_id];
switch (child->parent->dev_type) { switch (child->parent->dev_type) {
case SAS_EDGE_EXPANDER_DEVICE: case SAS_EDGE_EXPANDER_DEVICE:
if (sas_check_edge_expander_topo(child, parent_phy)) if (sas_check_edge_expander_topo(child, parent_phy))
res = -ENODEV; res = -ENODEV;
break; break;
case SAS_FANOUT_EXPANDER_DEVICE: case SAS_FANOUT_EXPANDER_DEVICE:
if (parent_phy->routing_attr != TABLE_ROUTING || if (sas_check_fanout_expander_topo(child, parent_phy))
child_phy->routing_attr != SUBTRACTIVE_ROUTING) {
sas_print_parent_topology_bug(child, parent_phy, child_phy);
res = -ENODEV; res = -ENODEV;
}
break; break;
default: default:
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment