Commit b4ec9830 authored by Niklas Cassel's avatar Niklas Cassel Committed by Martin K. Petersen
Browse files

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: default avatarNiklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250814173215.1765055-20-cassel@kernel.org


Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 35e38869
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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;
+10 −0
Original line number Diff line number Diff line
@@ -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)
{
+1 −0
Original line number Diff line number Diff line
@@ -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
+2 −4
Original line number Diff line number Diff line
@@ -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;