Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: ufs: core: Simplify ufshcd_try_to_abort_task()

The MCQ code is also valid for legacy mode. Hence, remove the legacy
mode code and retain the MCQ code. Since it is not an error if a command
completes while ufshcd_try_to_abort_task() is in progress, use
dev_info() instead of dev_err() to report this.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241022193130.2733293-4-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
9a5f6c09 7df89440

+8 -24
+8 -24
drivers/ufs/core/ufshcd.c
··· 7488 7488 int err; 7489 7489 int poll_cnt; 7490 7490 u8 resp = 0xF; 7491 - u32 reg; 7492 7491 7493 7492 for (poll_cnt = 100; poll_cnt; poll_cnt--) { 7494 7493 err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag, ··· 7502 7503 * cmd not pending in the device, check if it is 7503 7504 * in transition. 7504 7505 */ 7505 - dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n", 7506 + dev_info( 7507 + hba->dev, 7508 + "%s: cmd with tag %d not pending in the device.\n", 7506 7509 __func__, tag); 7507 - if (hba->mcq_enabled) { 7508 - /* MCQ mode */ 7509 - if (ufshcd_cmd_inflight(lrbp->cmd)) { 7510 - /* sleep for max. 200us same delay as in SDB mode */ 7511 - usleep_range(100, 200); 7512 - continue; 7513 - } 7514 - /* command completed already */ 7515 - dev_err(hba->dev, "%s: cmd at tag=%d is cleared.\n", 7516 - __func__, tag); 7510 + if (!ufshcd_cmd_inflight(lrbp->cmd)) { 7511 + dev_info(hba->dev, 7512 + "%s: cmd with tag=%d completed.\n", 7513 + __func__, tag); 7517 7514 return 0; 7518 7515 } 7519 - 7520 - /* Single Doorbell Mode */ 7521 - reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); 7522 - if (reg & (1 << tag)) { 7523 - /* sleep for max. 200us to stabilize */ 7524 - usleep_range(100, 200); 7525 - continue; 7526 - } 7527 - /* command completed already */ 7528 - dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", 7529 - __func__, tag); 7530 - return 0; 7516 + usleep_range(100, 200); 7531 7517 } else { 7532 7518 dev_err(hba->dev, 7533 7519 "%s: no response from device. tag = %d, err %d\n",