Skip to content

Commit 9c24f90

Browse files
Stanley Chumartinkpetersen
authored andcommitted
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: Bao D. Nguyen <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Keoseong Park <[email protected]> Acked-by: Bean Huo <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e01d05b commit 9c24f90

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

drivers/ufs/core/ufs-mcq.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,13 @@ void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba,
306306
spin_unlock_irqrestore(&hwq->cq_lock, flags);
307307
}
308308

309-
static unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
310-
struct ufs_hw_queue *hwq)
309+
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
310+
struct ufs_hw_queue *hwq)
311311
{
312312
unsigned long completed_reqs = 0;
313+
unsigned long flags;
313314

315+
spin_lock_irqsave(&hwq->cq_lock, flags);
314316
ufshcd_mcq_update_cq_tail_slot(hwq);
315317
while (!ufshcd_mcq_is_cq_empty(hwq)) {
316318
ufshcd_mcq_process_cqe(hba, hwq);
@@ -320,17 +322,6 @@ static unsigned long ufshcd_mcq_poll_cqe_nolock(struct ufs_hba *hba,
320322

321323
if (completed_reqs)
322324
ufshcd_mcq_update_cq_head(hwq);
323-
324-
return completed_reqs;
325-
}
326-
327-
unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba,
328-
struct ufs_hw_queue *hwq)
329-
{
330-
unsigned long completed_reqs, flags;
331-
332-
spin_lock_irqsave(&hwq->cq_lock, flags);
333-
completed_reqs = ufshcd_mcq_poll_cqe_nolock(hba, hwq);
334325
spin_unlock_irqrestore(&hwq->cq_lock, flags);
335326

336327
return completed_reqs;

0 commit comments

Comments
 (0)