FROMGIT: scsi: ufs: Introduce ufshcd_release_scsi_cmd()
The only functional change in this patch is that scsi_done() is now called after ufshcd_release() and ufshcd_clk_scaling_update_busy() instead of before. The next patch in this series will introduce a call to ufshcd_release_scsi_cmd() in the abort handler. Link: https://lore.kernel.org/r/20211203231950.193369-13-bvanassche@acm.org Tested-by: Bean Huo <beanhuo@micron.com> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Bean Huo <beanhuo@micron.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit 6f8dafdee6ae836763e753a9df288d10b35e9679 git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next) Bug: 204438323 Change-Id: Ie9e3ef49aa10d3dc9ce43625893809b232d87d5f Signed-off-by: Bart Van Assche <bvanassche@google.com> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
This commit is contained in:

committed by
Matthias Maennich

parent
d600bdedac
commit
21949c429a
@@ -5181,6 +5181,19 @@ static irqreturn_t ufshcd_uic_cmd_compl(struct ufs_hba *hba, u32 intr_status)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Release the resources allocated for processing a SCSI command. */
|
||||||
|
static void ufshcd_release_scsi_cmd(struct ufs_hba *hba,
|
||||||
|
struct ufshcd_lrb *lrbp)
|
||||||
|
{
|
||||||
|
struct scsi_cmnd *cmd = lrbp->cmd;
|
||||||
|
|
||||||
|
scsi_dma_unmap(cmd);
|
||||||
|
ufshcd_crypto_clear_prdt(hba, lrbp);
|
||||||
|
lrbp->cmd = NULL; /* Mark the command as completed. */
|
||||||
|
ufshcd_release(hba);
|
||||||
|
ufshcd_clk_scaling_update_busy(hba);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __ufshcd_transfer_req_compl - handle SCSI and query command completion
|
* __ufshcd_transfer_req_compl - handle SCSI and query command completion
|
||||||
* @hba: per adapter instance
|
* @hba: per adapter instance
|
||||||
@@ -5191,7 +5204,6 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
|
|||||||
{
|
{
|
||||||
struct ufshcd_lrb *lrbp;
|
struct ufshcd_lrb *lrbp;
|
||||||
struct scsi_cmnd *cmd;
|
struct scsi_cmnd *cmd;
|
||||||
int result;
|
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
for_each_set_bit(index, &completed_reqs, hba->nutrs) {
|
for_each_set_bit(index, &completed_reqs, hba->nutrs) {
|
||||||
@@ -5205,16 +5217,10 @@ static void __ufshcd_transfer_req_compl(struct ufs_hba *hba,
|
|||||||
ufshcd_update_monitor(hba, lrbp);
|
ufshcd_update_monitor(hba, lrbp);
|
||||||
trace_android_vh_ufs_compl_command(hba, lrbp);
|
trace_android_vh_ufs_compl_command(hba, lrbp);
|
||||||
ufshcd_add_command_trace(hba, index, "complete");
|
ufshcd_add_command_trace(hba, index, "complete");
|
||||||
result = ufshcd_transfer_rsp_status(hba, lrbp);
|
cmd->result = ufshcd_transfer_rsp_status(hba, lrbp);
|
||||||
scsi_dma_unmap(cmd);
|
ufshcd_release_scsi_cmd(hba, lrbp);
|
||||||
cmd->result = result;
|
|
||||||
ufshcd_crypto_clear_prdt(hba, lrbp);
|
|
||||||
/* Mark completed command as NULL in LRB */
|
|
||||||
lrbp->cmd = NULL;
|
|
||||||
/* Do not touch lrbp after scsi done */
|
/* Do not touch lrbp after scsi done */
|
||||||
cmd->scsi_done(cmd);
|
cmd->scsi_done(cmd);
|
||||||
ufshcd_release(hba);
|
|
||||||
ufshcd_clk_scaling_update_busy(hba);
|
|
||||||
} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
|
} else if (lrbp->command_type == UTP_CMD_TYPE_DEV_MANAGE ||
|
||||||
lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
|
lrbp->command_type == UTP_CMD_TYPE_UFS_STORAGE) {
|
||||||
if (hba->dev_cmd.complete) {
|
if (hba->dev_cmd.complete) {
|
||||||
|
Reference in New Issue
Block a user