scsi: ufs: core: Move code out of ufshcd_wait_for_dev_cmd()
The ufshcd_dev_cmd_completion() call is useful for some but not for all ufshcd_wait_for_dev_cmd() callers. Hence, remove the ufshcd_dev_cmd_completion() call from ufshcd_wait_for_dev_cmd() and move it past the ufshcd_issue_dev_cmd() calls where appropriate. This makes it easier to detect timeout errors for UPIU frames submitted through the BSG interface. Reviewed-by: Avri Altman <avri.altman@sandisk.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20251031204029.2883185-28-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
committed by
Martin K. Petersen
parent
4b6c0d9cca
commit
a11c015c8a
@@ -3265,8 +3265,6 @@ retry:
|
|||||||
|
|
||||||
if (likely(time_left)) {
|
if (likely(time_left)) {
|
||||||
err = ufshcd_get_tr_ocs(lrbp, NULL);
|
err = ufshcd_get_tr_ocs(lrbp, NULL);
|
||||||
if (!err)
|
|
||||||
err = ufshcd_dev_cmd_completion(hba, lrbp);
|
|
||||||
} else {
|
} else {
|
||||||
err = -ETIMEDOUT;
|
err = -ETIMEDOUT;
|
||||||
dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
|
dev_dbg(hba->dev, "%s: dev_cmd request timedout, tag %d\n",
|
||||||
@@ -3376,6 +3374,7 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
|
|||||||
{
|
{
|
||||||
const u32 tag = hba->reserved_slot;
|
const u32 tag = hba->reserved_slot;
|
||||||
struct scsi_cmnd *cmd = ufshcd_tag_to_cmd(hba, tag);
|
struct scsi_cmnd *cmd = ufshcd_tag_to_cmd(hba, tag);
|
||||||
|
struct ufshcd_lrb *lrbp = scsi_cmd_priv(cmd);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Protects use of hba->reserved_slot. */
|
/* Protects use of hba->reserved_slot. */
|
||||||
@@ -3385,7 +3384,11 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
|
|||||||
if (unlikely(err))
|
if (unlikely(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return ufshcd_issue_dev_cmd(hba, cmd, tag, timeout);
|
err = ufshcd_issue_dev_cmd(hba, cmd, tag, timeout);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return ufshcd_dev_cmd_completion(hba, lrbp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -7412,12 +7415,9 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
|
|||||||
|
|
||||||
memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
|
memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
|
||||||
|
|
||||||
/*
|
err = ufshcd_issue_dev_cmd(hba, cmd, tag, dev_cmd_timeout);
|
||||||
* ignore the returning value here - ufshcd_check_query_response is
|
if (err)
|
||||||
* bound to fail since dev_cmd.query and dev_cmd.type were left empty.
|
return err;
|
||||||
* read the response directly ignoring all errors.
|
|
||||||
*/
|
|
||||||
ufshcd_issue_dev_cmd(hba, cmd, tag, dev_cmd_timeout);
|
|
||||||
|
|
||||||
/* just copy the upiu response as it is */
|
/* just copy the upiu response as it is */
|
||||||
memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
|
memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
|
||||||
@@ -7563,7 +7563,10 @@ int ufshcd_advanced_rpmb_req_handler(struct ufs_hba *hba, struct utp_upiu_req *r
|
|||||||
memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
|
memset(lrbp->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
|
||||||
|
|
||||||
err = ufshcd_issue_dev_cmd(hba, cmd, tag, ADVANCED_RPMB_REQ_TIMEOUT);
|
err = ufshcd_issue_dev_cmd(hba, cmd, tag, ADVANCED_RPMB_REQ_TIMEOUT);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = ufshcd_dev_cmd_completion(hba, lrbp);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
/* Just copy the upiu response as it is */
|
/* Just copy the upiu response as it is */
|
||||||
memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
|
memcpy(rsp_upiu, lrbp->ucd_rsp_ptr, sizeof(*rsp_upiu));
|
||||||
|
|||||||
Reference in New Issue
Block a user