Commit 9c24f90f authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

scsi: ufs: core: Combine ufshcd_mq_poll_cqe functions

Currently, ufshcd_mcq_poll_cqe_nolock() is only called by
ufshcd_mcq_poll_cqe_lock() with the addition of a spinlock wrapper for
ufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one
results in cleaner code.
Reviewed-by: default avatarBao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Link: https://lore.kernel.org/r/20230601225048.12228-1-stanley.chu@mediatek.comReviewed-by: default avatarKeoseong Park <keosung.park@samsung.com>
Acked-by: default avatarBean Huo <beanhuo@micron.com>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e01d05bb
......@@ -306,11 +306,13 @@ void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba,
spin_unlock_irqrestore(&hwq->cq_lock, flags);
}
static unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
struct ufs_hw_queue *hwq)
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
struct ufs_hw_queue *hwq)
{
unsigned long completed_reqs = 0;
unsigned long flags;
spin_lock_irqsave(&hwq->cq_lock, flags);
ufshcd_mcq_update_cq_tail_slot(hwq);
while (!ufshcd_mcq_is_cq_empty(hwq)) {
ufshcd_mcq_process_cqe(hba, hwq);
......@@ -320,17 +322,6 @@ static unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
if (completed_reqs)
ufshcd_mcq_update_cq_head(hwq);
return completed_reqs;
}
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
struct ufs_hw_queue *hwq)
{
unsigned long completed_reqs, flags;
spin_lock_irqsave(&hwq->cq_lock, flags);
completed_reqs = ufshcd_mcq_poll_cqe_nolock(hba, hwq);
spin_unlock_irqrestore(&hwq->cq_lock, flags);
return completed_reqs;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment