mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
@ 2023-06-01 22:50 Stanley Chu
       [not found] ` <CGME20230601225112epcas2p1469011fa8e11c1c31c1f867daeab106f@epcms2p3>
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stanley Chu @ 2023-06-01 22:50 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, martin.petersen, avri.altman,
	alim.akhtar, jejb, bvanassche
  Cc: stanley.chu

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 would result in cleaner code.

Reviewed-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/ufs/core/ufs-mcq.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 920eb954f594..785fc9762cad 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -307,11 +307,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);
@@ -321,17 +323,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;
-- 
2.18.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-08  1:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 22:50 [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
     [not found] ` <CGME20230601225112epcas2p1469011fa8e11c1c31c1f867daeab106f@epcms2p3>
2023-06-07  5:27   ` Keoseong Park
2023-06-07  8:41 ` Bean Huo
2023-06-07 18:53 ` Bart Van Assche
2023-06-08  1:12 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®