Skip to content

Commit 9d88045

Browse files
ColinIanKingvinodkoul
authored andcommitted
dmaengine: amd: qdma: make read-only arrays h2c_types and c2h_types static const
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 24947be commit 9d88045

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

drivers/dma/amd/qdma/qdma.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,20 @@ static int qdma_check_queue_status(struct qdma_device *qdev,
283283

284284
static int qdma_clear_queue_context(const struct qdma_queue *queue)
285285
{
286-
enum qdma_ctxt_type h2c_types[] = { QDMA_CTXT_DESC_SW_H2C,
287-
QDMA_CTXT_DESC_HW_H2C,
288-
QDMA_CTXT_DESC_CR_H2C,
289-
QDMA_CTXT_PFTCH, };
290-
enum qdma_ctxt_type c2h_types[] = { QDMA_CTXT_DESC_SW_C2H,
291-
QDMA_CTXT_DESC_HW_C2H,
292-
QDMA_CTXT_DESC_CR_C2H,
293-
QDMA_CTXT_PFTCH, };
286+
static const enum qdma_ctxt_type h2c_types[] = {
287+
QDMA_CTXT_DESC_SW_H2C,
288+
QDMA_CTXT_DESC_HW_H2C,
289+
QDMA_CTXT_DESC_CR_H2C,
290+
QDMA_CTXT_PFTCH,
291+
};
292+
static const enum qdma_ctxt_type c2h_types[] = {
293+
QDMA_CTXT_DESC_SW_C2H,
294+
QDMA_CTXT_DESC_HW_C2H,
295+
QDMA_CTXT_DESC_CR_C2H,
296+
QDMA_CTXT_PFTCH,
297+
};
294298
struct qdma_device *qdev = queue->qdev;
295-
enum qdma_ctxt_type *type;
299+
const enum qdma_ctxt_type *type;
296300
int ret, num, i;
297301

298302
if (queue->dir == DMA_MEM_TO_DEV) {

0 commit comments

Comments
 (0)