ufs: core: Combine ufshcd_mq_poll_cqe functions
Subsystems (2)
PATCH v2 1/1 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 would result in cleaner code.
--- drivers/ufs/core/ufs-mcq.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/ufs/core/ufs-mcq.c +4 -13
@@ -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;
Signature · 1 line
2.18.0
Quoted 52 lines
Currently,
ufshcd_mcq_poll_cqe_nolock()is only called byufshcd_mcq_poll_cqe_lock()with the addition of a spinlock wrapper forufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one would result in cleaner code.Reviewed-by Bao D. Nguyen <[email protected]>Signed-off-by Stanley Chu <[email protected]>---
drivers/ufs/core/ufs-mcq.c| 17 ++++-------------1 file changed, 4 insertions(+), 13 deletions(-)drivers/ufs/core/ufs-mcq.c +4
-13@@ -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;Signature · 1 line
2.18.0
Looks good to me.
Best Regards,
Keoseong
Quoted 7 lines · Stanley Chu
Currently,
ufshcd_mcq_poll_cqe_nolock()is only called byufshcd_mcq_poll_cqe_lock()with the addition of a spinlock wrapper forufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one would result in cleaner code.Reviewed-by Bao D. Nguyen<[email protected]>Signed-off-by Stanley Chu<[email protected]>
Quoted 4 lines · Stanley Chu
Currently,
ufshcd_mcq_poll_cqe_nolock()is only called byufshcd_mcq_poll_cqe_lock()with the addition of a spinlock wrapper forufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one would result in cleaner code.
For future patches, please use the imperative mood for the patch description ("would result in" -> "results in"). Additionally, a follow-up patch that renames ufshcd_mcq_poll_cqe_lock() into ufshcd_mcq_poll_cqe() would be welcome. Anyway:
Martin K. Petersen
AppliedStanley,
Quoted 4 lines
Currently,
ufshcd_mcq_poll_cqe_nolock()is only called byufshcd_mcq_poll_cqe_lock()with the addition of a spinlock wrapper forufshcd_mcq_poll_cqe_nolock(). Combining these two functions into one would result in cleaner code.
Applied to 6.5/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering