mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][next] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
@ 2024-09-12 13:10 Colin Ian King
  2024-12-04 13:19 ` Vinod Koul
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2024-09-12 13:10 UTC (permalink / raw)
  To: Nishad Saraf, Lizhi Hou, Vinod Koul, dmaengine
  Cc: kernel-janitors, linux-kernel

Don't populate the read-only arrays h2c_types and c2h_types on the
stack at run time, instead make them static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/dma/amd/qdma/qdma.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/dma/amd/qdma/qdma.c b/drivers/dma/amd/qdma/qdma.c
index b0a1f3ad851b..17a876df9fb3 100644
--- a/drivers/dma/amd/qdma/qdma.c
+++ b/drivers/dma/amd/qdma/qdma.c
@@ -283,16 +283,20 @@ static int qdma_check_queue_status(struct qdma_device *qdev,
 
 static int qdma_clear_queue_context(const struct qdma_queue *queue)
 {
-	enum qdma_ctxt_type h2c_types[] = { QDMA_CTXT_DESC_SW_H2C,
-					    QDMA_CTXT_DESC_HW_H2C,
-					    QDMA_CTXT_DESC_CR_H2C,
-					    QDMA_CTXT_PFTCH, };
-	enum qdma_ctxt_type c2h_types[] = { QDMA_CTXT_DESC_SW_C2H,
-					    QDMA_CTXT_DESC_HW_C2H,
-					    QDMA_CTXT_DESC_CR_C2H,
-					    QDMA_CTXT_PFTCH, };
+	static const enum qdma_ctxt_type h2c_types[] = {
+		QDMA_CTXT_DESC_SW_H2C,
+		QDMA_CTXT_DESC_HW_H2C,
+		QDMA_CTXT_DESC_CR_H2C,
+		QDMA_CTXT_PFTCH,
+	};
+	static const enum qdma_ctxt_type c2h_types[] = {
+		QDMA_CTXT_DESC_SW_C2H,
+		QDMA_CTXT_DESC_HW_C2H,
+		QDMA_CTXT_DESC_CR_C2H,
+		QDMA_CTXT_PFTCH,
+	};
 	struct qdma_device *qdev = queue->qdev;
-	enum qdma_ctxt_type *type;
+	const enum qdma_ctxt_type *type;
 	int ret, num, i;
 
 	if (queue->dir == DMA_MEM_TO_DEV) {
-- 
2.39.2


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

* Re: [PATCH][next] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
  2024-09-12 13:10 [PATCH][next] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const Colin Ian King
@ 2024-12-04 13:19 ` Vinod Koul
  0 siblings, 0 replies; 2+ messages in thread
From: Vinod Koul @ 2024-12-04 13:19 UTC (permalink / raw)
  To: Nishad Saraf, Lizhi Hou, dmaengine, Colin Ian King
  Cc: kernel-janitors, linux-kernel


On Thu, 12 Sep 2024 14:10:17 +0100, Colin Ian King wrote:
> Don't populate the read-only arrays h2c_types and c2h_types on the
> stack at run time, instead make them static const.
> 
> 

Applied, thanks!

[1/1] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
      commit: 7a155fefec85af91b5b13909ab18090b2672aa8b

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2024-12-04 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-12 13:10 [PATCH][next] dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const Colin Ian King
2024-12-04 13:19 ` Vinod Koul

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®