Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

octeontx2-af: Change block parameter to const pointer in get_lf_str_list

Convert struct rvu_block block to const struct rvu_block *block in
get_lf_str_list() function parameter. This improves efficiency by
avoiding structure copying and reflects the function's read-only
access to block.

Signed-off-by: Riyan Dhiman <riyandhiman14@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241001110542.5404-2-riyandhiman14@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Riyan Dhiman and committed by
Jakub Kicinski
c55ff46a 8389cdb5

+7 -7
+7 -7
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
··· 663 663 664 664 RVU_DEBUG_FOPS(lmtst_map_table, lmtst_map_table_display, NULL); 665 665 666 - static void get_lf_str_list(struct rvu_block block, int pcifunc, 666 + static void get_lf_str_list(const struct rvu_block *block, int pcifunc, 667 667 char *lfs) 668 668 { 669 - int lf = 0, seq = 0, len = 0, prev_lf = block.lf.max; 669 + int lf = 0, seq = 0, len = 0, prev_lf = block->lf.max; 670 670 671 - for_each_set_bit(lf, block.lf.bmap, block.lf.max) { 672 - if (lf >= block.lf.max) 671 + for_each_set_bit(lf, block->lf.bmap, block->lf.max) { 672 + if (lf >= block->lf.max) 673 673 break; 674 674 675 - if (block.fn_map[lf] != pcifunc) 675 + if (block->fn_map[lf] != pcifunc) 676 676 continue; 677 677 678 678 if (lf == prev_lf + 1) { ··· 719 719 if (!strlen(block.name)) 720 720 continue; 721 721 722 - get_lf_str_list(block, pcifunc, buf); 722 + get_lf_str_list(&block, pcifunc, buf); 723 723 if (lf_str_size <= strlen(buf)) 724 724 lf_str_size = strlen(buf) + 1; 725 725 } ··· 803 803 continue; 804 804 len = 0; 805 805 lfs[len] = '\0'; 806 - get_lf_str_list(block, pcifunc, lfs); 806 + get_lf_str_list(&block, pcifunc, lfs); 807 807 if (strlen(lfs)) 808 808 flag = 1; 809 809