* [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
@ 2023-06-01 22:50 ` Stanley Chu
2023-06-07 5:27 ` Keoseong Park
` (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 related [flat|nested] 5+ messages in thread
* RE: [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
2023-06-01 22:50 ` [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
@ 2023-06-07 5:27 ` Keoseong Park
2023-06-07 8:41 ` Bean Huo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Keoseong Park @ 2023-06-07 5:27 UTC (permalink / raw)
To: Stanley Chu, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, martin.petersen@oracle.com,
avri.altman@wdc.com, ALIM AKHTAR, jejb@linux.ibm.com,
bvanassche@acm.org
>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
>
Looks good to me.
Reviewed-by: Keoseong Park <keosung.park@samsung.com>
Best Regards,
Keoseong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
2023-06-01 22:50 ` [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
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
3 siblings, 0 replies; 5+ messages in thread
From: Bean Huo @ 2023-06-07 8:41 UTC (permalink / raw)
To: Stanley Chu, linux-scsi, linux-kernel, martin.petersen,
avri.altman, alim.akhtar, jejb, bvanassche
On 02.06.23 12:50 AM, Stanley Chu wrote:
> 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>
Acked-by: Bean Huo <beanhuo@micron.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
2023-06-01 22:50 ` [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
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
3 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2023-06-07 18:53 UTC (permalink / raw)
To: Stanley Chu, linux-scsi, linux-kernel, martin.petersen,
avri.altman, alim.akhtar, jejb
On 6/1/23 15:50, Stanley Chu wrote:
> 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.
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:
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions
2023-06-01 22:50 ` [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
` (2 preceding siblings ...)
2023-06-07 18:53 ` Bart Van Assche
@ 2023-06-08 1:12 ` Martin K. Petersen
3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2023-06-08 1:12 UTC (permalink / raw)
To: Stanley Chu
Cc: linux-scsi, linux-kernel, martin.petersen, avri.altman,
alim.akhtar, jejb, bvanassche
Stanley,
> 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.
Applied to 6.5/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ 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 --
[not found] <CGME20230601225112epcas2p1469011fa8e11c1c31c1f867daeab106f@epcms2p3>
2023-06-01 22:50 ` [PATCH v2] ufs: core: Combine ufshcd_mq_poll_cqe functions Stanley Chu
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