public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ufs: mcq: Fix missing argument 'hba' in MCQ_OPR_OFFSET_n
       [not found] <CGME20240516032553epcas2p3b8f34d03f32cccccc628027fbe1e8356@epcas2p3.samsung.com>
@ 2024-05-16  3:14 ` Minwoo Im
  2024-05-16 14:03   ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Minwoo Im @ 2024-05-16  3:14 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen, Alim Akhtar,
	Avri Altman, Bart Van Assche
  Cc: linux-scsi, linux-kernel, Joel Granados, gost.dev, Minwoo Im,
	Asutosh Das

The MCQ_OPR_OFFSET_n macro has taken 'hba' on the caller context
without receiving 'hba' instance as an argument.  To prevent potential
bugs in future use cases, this patch added an argument 'hba'.

Fixes: 2468da61ea09 ("scsi: ufs: core: mcq: Configure operation and runtime interface")
Cc: Asutosh Das <quic_asutoshd@quicinc.com>
Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
---
 drivers/ufs/core/ufs-mcq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c
index 768bf87cd80d..1cfdda9acb0a 100644
--- a/drivers/ufs/core/ufs-mcq.c
+++ b/drivers/ufs/core/ufs-mcq.c
@@ -231,7 +231,7 @@ int ufshcd_mcq_memory_alloc(struct ufs_hba *hba)
 
 /* Operation and runtime registers configuration */
 #define MCQ_CFG_n(r, i)	((r) + MCQ_QCFG_SIZE * (i))
-#define MCQ_OPR_OFFSET_n(p, i) \
+#define MCQ_OPR_OFFSET_n(hba, p, i) \
 	(hba->mcq_opr[(p)].offset + hba->mcq_opr[(p)].stride * (i))
 
 static void __iomem *mcq_opr_base(struct ufs_hba *hba,
@@ -343,10 +343,10 @@ void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba)
 		ufsmcq_writelx(hba, upper_32_bits(hwq->sqe_dma_addr),
 			      MCQ_CFG_n(REG_SQUBA, i));
 		/* Submission Queue Doorbell Address Offset */
-		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(OPR_SQD, i),
+		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(hba, OPR_SQD, i),
 			      MCQ_CFG_n(REG_SQDAO, i));
 		/* Submission Queue Interrupt Status Address Offset */
-		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(OPR_SQIS, i),
+		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(hba, OPR_SQIS, i),
 			      MCQ_CFG_n(REG_SQISAO, i));
 
 		/* Completion Queue Lower Base Address */
@@ -356,10 +356,10 @@ void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba)
 		ufsmcq_writelx(hba, upper_32_bits(hwq->cqe_dma_addr),
 			      MCQ_CFG_n(REG_CQUBA, i));
 		/* Completion Queue Doorbell Address Offset */
-		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(OPR_CQD, i),
+		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(hba, OPR_CQD, i),
 			      MCQ_CFG_n(REG_CQDAO, i));
 		/* Completion Queue Interrupt Status Address Offset */
-		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(OPR_CQIS, i),
+		ufsmcq_writelx(hba, MCQ_OPR_OFFSET_n(hba, OPR_CQIS, i),
 			      MCQ_CFG_n(REG_CQISAO, i));
 
 		/* Save the base addresses for quicker access */
-- 
2.34.1


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

* Re: [PATCH] ufs: mcq: Fix missing argument 'hba' in MCQ_OPR_OFFSET_n
  2024-05-16  3:14 ` [PATCH] ufs: mcq: Fix missing argument 'hba' in MCQ_OPR_OFFSET_n Minwoo Im
@ 2024-05-16 14:03   ` Bart Van Assche
  2024-05-19 20:39     ` Minwoo Im
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2024-05-16 14:03 UTC (permalink / raw)
  To: Minwoo Im, James E . J . Bottomley, Martin K . Petersen,
	Alim Akhtar, Avri Altman
  Cc: linux-scsi, linux-kernel, Joel Granados, gost.dev, Asutosh Das

On 5/15/24 21:14, Minwoo Im wrote:
>   /* Operation and runtime registers configuration */
>   #define MCQ_CFG_n(r, i)	((r) + MCQ_QCFG_SIZE * (i))
> -#define MCQ_OPR_OFFSET_n(p, i) \
> +#define MCQ_OPR_OFFSET_n(hba, p, i) \
>   	(hba->mcq_opr[(p)].offset + hba->mcq_opr[(p)].stride * (i))
Since inline functions are preferred over macros, please convert the
MCQ_OPR_OFFSET_n() macro into an inline function.

Thanks,

Bart.

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

* Re: [PATCH] ufs: mcq: Fix missing argument 'hba' in MCQ_OPR_OFFSET_n
  2024-05-16 14:03   ` Bart Van Assche
@ 2024-05-19 20:39     ` Minwoo Im
  0 siblings, 0 replies; 3+ messages in thread
From: Minwoo Im @ 2024-05-19 20:39 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: James E . J . Bottomley, Martin K . Petersen, Alim Akhtar,
	Avri Altman, linux-scsi, linux-kernel, Joel Granados, gost.dev,
	Asutosh Das, Minwoo Im

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

On 24-05-16 08:03:17, Bart Van Assche wrote:
> On 5/15/24 21:14, Minwoo Im wrote:
> >   /* Operation and runtime registers configuration */
> >   #define MCQ_CFG_n(r, i)	((r) + MCQ_QCFG_SIZE * (i))
> > -#define MCQ_OPR_OFFSET_n(p, i) \
> > +#define MCQ_OPR_OFFSET_n(hba, p, i) \
> >   	(hba->mcq_opr[(p)].offset + hba->mcq_opr[(p)].stride * (i))
> Since inline functions are preferred over macros, please convert the
> MCQ_OPR_OFFSET_n() macro into an inline function.

Okay.  I will prepare v2.

> 
> Thanks,
> 
> Bart.
> 

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2024-05-19 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20240516032553epcas2p3b8f34d03f32cccccc628027fbe1e8356@epcas2p3.samsung.com>
2024-05-16  3:14 ` [PATCH] ufs: mcq: Fix missing argument 'hba' in MCQ_OPR_OFFSET_n Minwoo Im
2024-05-16 14:03   ` Bart Van Assche
2024-05-19 20:39     ` Minwoo Im

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