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

scsi: ufs: core: Fix ufshcd_is_ufs_dev_busy() and ufshcd_eh_timed_out()

ufshcd_is_ufs_dev_busy(), ufshcd_print_host_state() and
ufshcd_eh_timed_out() are used in both modes (legacy mode and MCQ mode).
hba->outstanding_reqs only represents the outstanding requests in legacy
mode. Hence, change hba->outstanding_reqs into scsi_host_busy(hba->host) in
these functions.

Fixes: eacb139b77ff ("scsi: ufs: core: mcq: Enable multi-circular queue")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20250214224352.3025151-1-bvanassche@acm.org
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
4fa382be 5233e323

+4 -4
+4 -4
drivers/ufs/core/ufshcd.c
··· 266 266 267 267 static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba) 268 268 { 269 - return hba->outstanding_reqs || ufshcd_has_pending_tasks(hba); 269 + return scsi_host_busy(hba->host) || ufshcd_has_pending_tasks(hba); 270 270 } 271 271 272 272 static const struct ufs_dev_quirk ufs_fixups[] = { ··· 628 628 const struct scsi_device *sdev_ufs = hba->ufs_device_wlun; 629 629 630 630 dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); 631 - dev_err(hba->dev, "outstanding reqs=0x%lx tasks=0x%lx\n", 632 - hba->outstanding_reqs, hba->outstanding_tasks); 631 + dev_err(hba->dev, "%d outstanding reqs, tasks=0x%lx\n", 632 + scsi_host_busy(hba->host), hba->outstanding_tasks); 633 633 dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", 634 634 hba->saved_err, hba->saved_uic_err); 635 635 dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", ··· 8882 8882 dev_info(hba->dev, "%s() finished; outstanding_tasks = %#lx.\n", 8883 8883 __func__, hba->outstanding_tasks); 8884 8884 8885 - return hba->outstanding_reqs ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE; 8885 + return scsi_host_busy(hba->host) ? SCSI_EH_RESET_TIMER : SCSI_EH_DONE; 8886 8886 } 8887 8887 8888 8888 static const struct attribute_group *ufshcd_driver_groups[] = {