Skip to content

Commit

Permalink
scsi: hisi_sas: Start delivery hisi_sas_task_exec() directly
Browse files Browse the repository at this point in the history
[ Upstream commit 0e46208 ]

Currently we start delivery of commands to the DQ after returning from
hisi_sas_task_exec() with success.

Let's just start delivery directly in that function without having to check
if some local variable is set.

Link: https://lore.kernel.org/r/1639579061-179473-2-git-send-email-john.garry@huawei.com
Reviewed-by: Xiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Stable-dep-of: 8aa580c ("scsi: hisi_sas: Enable force phy when SATA disk directly connected")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
John Garry authored and Greg Kroah-Hartman committed May 2, 2025
1 parent 9e5a0f5 commit 9ebfa3e
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions drivers/scsi/hisi_sas/hisi_sas_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,7 @@ static int hisi_sas_dif_dma_map(struct hisi_hba *hisi_hba,

static int hisi_sas_task_prep(struct sas_task *task,
struct hisi_sas_dq **dq_pointer,
bool is_tmf, struct hisi_sas_tmf_task *tmf,
int *pass)
bool is_tmf, struct hisi_sas_tmf_task *tmf)
{
struct domain_device *device = task->dev;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
Expand Down Expand Up @@ -544,9 +543,12 @@ static int hisi_sas_task_prep(struct sas_task *task,
task->task_state_flags |= SAS_TASK_AT_INITIATOR;
spin_unlock_irqrestore(&task->task_state_lock, flags);

++(*pass);
WRITE_ONCE(slot->ready, 1);

spin_lock(&dq->lock);
hisi_hba->hw->start_delivery(dq);
spin_unlock(&dq->lock);

return 0;

err_out_dif_dma_unmap:
Expand All @@ -564,7 +566,6 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
bool is_tmf, struct hisi_sas_tmf_task *tmf)
{
u32 rc;
u32 pass = 0;
struct hisi_hba *hisi_hba;
struct device *dev;
struct domain_device *device = task->dev;
Expand Down Expand Up @@ -597,16 +598,10 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
}

/* protect task_prep and start_delivery sequence */
rc = hisi_sas_task_prep(task, &dq, is_tmf, tmf, &pass);
rc = hisi_sas_task_prep(task, &dq, is_tmf, tmf);
if (rc)
dev_err(dev, "task exec: failed[%d]!\n", rc);

if (likely(pass)) {
spin_lock(&dq->lock);
hisi_hba->hw->start_delivery(dq);
spin_unlock(&dq->lock);
}

return rc;
}

Expand Down

0 comments on commit 9ebfa3e

Please sign in to comment.