Skip to content

Commit 9fa2688

Browse files
beanhuomartinkpetersen
authored andcommitted
scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
Add helper inline for retrieving whether UFS device is busy or not. Signed-off-by: Bean Huo <beanhuo@micron.com> Link: https://lore.kernel.org/r/20231212220825.85255-2-beanhuo@iokpp.de Reviewed-by: Avri Altman <avri.altman@wdc.com> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b85ea95 commit 9fa2688

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/ufs/core/ufshcd.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
235235
return UFS_PM_LVL_0;
236236
}
237237

238+
static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)
239+
{
240+
return (hba->clk_gating.active_reqs || hba->outstanding_reqs || hba->outstanding_tasks ||
241+
hba->active_uic_cmd || hba->uic_async_done);
242+
}
243+
238244
static const struct ufs_dev_quirk ufs_fixups[] = {
239245
/* UFS cards deviations table */
240246
{ .wmanufacturerid = UFS_VENDOR_MICRON,
@@ -1917,10 +1923,7 @@ static void ufshcd_gate_work(struct work_struct *work)
19171923
goto rel_lock;
19181924
}
19191925

1920-
if (hba->clk_gating.active_reqs
1921-
|| hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL
1922-
|| hba->outstanding_reqs || hba->outstanding_tasks
1923-
|| hba->active_uic_cmd || hba->uic_async_done)
1926+
if (ufshcd_is_ufs_dev_busy(hba) || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL)
19241927
goto rel_lock;
19251928

19261929
spin_unlock_irqrestore(hba->host->host_lock, flags);

0 commit comments

Comments
 (0)