Skip to content

Commit

Permalink
scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
Browse files Browse the repository at this point in the history
Add helper inline for retrieving whether UFS device is busy or not.

Signed-off-by: Bean Huo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Avri Altman <[email protected]>
Reviewed-by: Thomas Weißschuh <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
beanhuo authored and martinkpetersen committed Dec 14, 2023
1 parent b85ea95 commit 9fa2688
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions drivers/ufs/core/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ ufs_get_desired_pm_lvl_for_dev_link_state(enum ufs_dev_pwr_mode dev_state,
return UFS_PM_LVL_0;
}

static bool ufshcd_is_ufs_dev_busy(struct ufs_hba *hba)
{
return (hba->clk_gating.active_reqs || hba->outstanding_reqs || hba->outstanding_tasks ||
hba->active_uic_cmd || hba->uic_async_done);
}

static const struct ufs_dev_quirk ufs_fixups[] = {
/* UFS cards deviations table */
{ .wmanufacturerid = UFS_VENDOR_MICRON,
Expand Down Expand Up @@ -1917,10 +1923,7 @@ static void ufshcd_gate_work(struct work_struct *work)
goto rel_lock;
}

if (hba->clk_gating.active_reqs
|| hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL
|| hba->outstanding_reqs || hba->outstanding_tasks
|| hba->active_uic_cmd || hba->uic_async_done)
if (ufshcd_is_ufs_dev_busy(hba) || hba->ufshcd_state != UFSHCD_STATE_OPERATIONAL)
goto rel_lock;

spin_unlock_irqrestore(hba->host->host_lock, flags);
Expand Down

0 comments on commit 9fa2688

Please sign in to comment.