diff options
author | Igor Pylypiv <ipylypiv@google.com> | 2024-11-21 11:49:15 -0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-12-04 14:43:48 -0500 |
commit | 0f630c58e31afb3dc2373bc1126b555f4b480bb2 (patch) | |
tree | a8ae3a24b58d239a88dcc4c44a7b785b6b8b466d | |
parent | 841df27d619ee1f5ca6473e15227b39d6136562d (diff) | |
download | linux-0f630c58e31afb3dc2373bc1126b555f4b480bb2.tar.gz linux-0f630c58e31afb3dc2373bc1126b555f4b480bb2.tar.bz2 linux-0f630c58e31afb3dc2373bc1126b555f4b480bb2.zip |
scsi: pm80xx: Do not use libsas port ID
libsas port IDs can differ from the controller's port IDs. Using libsas
port ID to index pm8001_ha->port array is a bug.
Remove sas_find_local_port_id(). We can use pm8001_ha->phy[phy_id].port to
get the port ID.
Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Terrence Adams <tadamsjr@google.com>
Link: https://lore.kernel.org/r/20241121194915.3039073-1-tadamsjr@google.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index d80cffd25a6e..a5b72c03b6a8 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -374,23 +374,6 @@ static int pm8001_task_prep_ssp(struct pm8001_hba_info *pm8001_ha, return PM8001_CHIP_DISP->ssp_io_req(pm8001_ha, ccb); } - /* Find the local port id that's attached to this device */ -static int sas_find_local_port_id(struct domain_device *dev) -{ - struct domain_device *pdev = dev->parent; - - /* Directly attached device */ - if (!pdev) - return dev->port->id; - while (pdev) { - struct domain_device *pdev_p = pdev->parent; - if (!pdev_p) - return pdev->port->id; - pdev = pdev->parent; - } - return 0; -} - #define DEV_IS_GONE(pm8001_dev) \ ((!pm8001_dev || (pm8001_dev->dev_type == SAS_PHY_UNUSED))) @@ -463,10 +446,10 @@ int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags) spin_lock_irqsave(&pm8001_ha->lock, flags); pm8001_dev = dev->lldd_dev; - port = &pm8001_ha->port[sas_find_local_port_id(dev)]; + port = pm8001_ha->phy[pm8001_dev->attached_phy].port; if (!internal_abort && - (DEV_IS_GONE(pm8001_dev) || !port->port_attached)) { + (DEV_IS_GONE(pm8001_dev) || !port || !port->port_attached)) { ts->resp = SAS_TASK_UNDELIVERED; ts->stat = SAS_PHY_DOWN; if (sas_protocol_ata(task_proto)) { |