Commit 0e462085 authored by John Garry's avatar John Garry Committed by Martin K. Petersen

scsi: hisi_sas: Start delivery hisi_sas_task_exec() directly

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.comReviewed-by: default avatarXiang Chen <chenxiang66@hisilicon.com>
Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent efac162a
...@@ -397,8 +397,7 @@ static int hisi_sas_dif_dma_map(struct hisi_hba *hisi_hba, ...@@ -397,8 +397,7 @@ static int hisi_sas_dif_dma_map(struct hisi_hba *hisi_hba,
static int hisi_sas_task_prep(struct sas_task *task, static int hisi_sas_task_prep(struct sas_task *task,
struct hisi_sas_dq **dq_pointer, struct hisi_sas_dq **dq_pointer,
bool is_tmf, struct hisi_sas_tmf_task *tmf, bool is_tmf, struct hisi_sas_tmf_task *tmf)
int *pass)
{ {
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
struct hisi_hba *hisi_hba = dev_to_hisi_hba(device); struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
...@@ -536,9 +535,12 @@ static int hisi_sas_task_prep(struct sas_task *task, ...@@ -536,9 +535,12 @@ static int hisi_sas_task_prep(struct sas_task *task,
task->task_state_flags |= SAS_TASK_AT_INITIATOR; task->task_state_flags |= SAS_TASK_AT_INITIATOR;
spin_unlock_irqrestore(&task->task_state_lock, flags); spin_unlock_irqrestore(&task->task_state_lock, flags);
++(*pass);
WRITE_ONCE(slot->ready, 1); WRITE_ONCE(slot->ready, 1);
spin_lock(&dq->lock);
hisi_hba->hw->start_delivery(dq);
spin_unlock(&dq->lock);
return 0; return 0;
err_out_dif_dma_unmap: err_out_dif_dma_unmap:
...@@ -556,7 +558,6 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, ...@@ -556,7 +558,6 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
bool is_tmf, struct hisi_sas_tmf_task *tmf) bool is_tmf, struct hisi_sas_tmf_task *tmf)
{ {
u32 rc; u32 rc;
u32 pass = 0;
struct hisi_hba *hisi_hba; struct hisi_hba *hisi_hba;
struct device *dev; struct device *dev;
struct domain_device *device = task->dev; struct domain_device *device = task->dev;
...@@ -589,16 +590,10 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags, ...@@ -589,16 +590,10 @@ static int hisi_sas_task_exec(struct sas_task *task, gfp_t gfp_flags,
} }
/* protect task_prep and start_delivery sequence */ /* 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) if (rc)
dev_err(dev, "task exec: failed[%d]!\n", 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; return rc;
} }
......
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