scsi: pm80xx: Add helper function to get the local phy id
Avoid duplicated code by adding a helper to get the local phy id. No functional changes intended. Signed-off-by: Niklas Cassel <cassel@kernel.org> Link: https://lore.kernel.org/r/20250814173215.1765055-20-cassel@kernel.org Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
35e388696c
commit
b4ec98303f
@@ -4184,10 +4184,9 @@ static int pm8001_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
|
||||
dev_is_expander(pm8001_dev->dev_type))
|
||||
stp_sspsmp_sata = 0x01; /*ssp or smp*/
|
||||
}
|
||||
if (dev_parent_is_expander(dev))
|
||||
phy_id = dev->parent->ex_dev.ex_phy->phy_id;
|
||||
else
|
||||
phy_id = pm8001_dev->attached_phy;
|
||||
|
||||
phy_id = pm80xx_get_local_phy_id(dev);
|
||||
|
||||
opc = OPC_INB_REG_DEV;
|
||||
linkrate = (pm8001_dev->sas_device->linkrate < dev->port->linkrate) ?
|
||||
pm8001_dev->sas_device->linkrate : dev->port->linkrate;
|
||||
|
||||
@@ -130,6 +130,16 @@ static void pm80xx_get_tag_opcodes(struct sas_task *task, int *ata_op,
|
||||
}
|
||||
}
|
||||
|
||||
u32 pm80xx_get_local_phy_id(struct domain_device *dev)
|
||||
{
|
||||
struct pm8001_device *pm8001_dev = dev->lldd_dev;
|
||||
|
||||
if (dev_parent_is_expander(dev))
|
||||
return dev->parent->ex_dev.ex_phy->phy_id;
|
||||
|
||||
return pm8001_dev->attached_phy;
|
||||
}
|
||||
|
||||
void pm80xx_show_pending_commands(struct pm8001_hba_info *pm8001_ha,
|
||||
struct pm8001_device *target_pm8001_dev)
|
||||
{
|
||||
|
||||
@@ -798,6 +798,7 @@ void pm8001_setds_completion(struct domain_device *dev);
|
||||
void pm8001_tmf_aborted(struct sas_task *task);
|
||||
void pm80xx_show_pending_commands(struct pm8001_hba_info *pm8001_ha,
|
||||
struct pm8001_device *dev);
|
||||
u32 pm80xx_get_local_phy_id(struct domain_device *dev);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -4797,10 +4797,8 @@ static int pm80xx_chip_reg_dev_req(struct pm8001_hba_info *pm8001_ha,
|
||||
dev_is_expander(pm8001_dev->dev_type))
|
||||
stp_sspsmp_sata = 0x01; /*ssp or smp*/
|
||||
}
|
||||
if (dev_parent_is_expander(dev))
|
||||
phy_id = dev->parent->ex_dev.ex_phy->phy_id;
|
||||
else
|
||||
phy_id = pm8001_dev->attached_phy;
|
||||
|
||||
phy_id = pm80xx_get_local_phy_id(dev);
|
||||
|
||||
opc = OPC_INB_REG_DEV;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user