Skip to contentSkip to conversation

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

PATCH Applied Riyan Dhiman 3 participants 3 messages Oct 1, 2024 – Oct 4, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
v2: change target branch to net-next and remove fix tag. Compile tested only

 .../ethernet/marvell/octeontx2/af/rvu_debugfs.c    | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +7 -7
index 87ba77e5026a..8c700ee4a82b 100644
@@ -663,16 +663,16 @@ static ssize_t rvu_dbg_lmtst_map_table_display(struct file *filp,
 
 RVU_DEBUG_FOPS(lmtst_map_table, lmtst_map_table_display, NULL);
 
-static void get_lf_str_list(struct rvu_block block, int pcifunc,
+static void get_lf_str_list(const struct rvu_block *block, int pcifunc,
 			    char *lfs)
 {
-	int lf = 0, seq = 0, len = 0, prev_lf = block.lf.max;
+	int lf = 0, seq = 0, len = 0, prev_lf = block->lf.max;
 
-	for_each_set_bit(lf, block.lf.bmap, block.lf.max) {
-		if (lf >= block.lf.max)
+	for_each_set_bit(lf, block->lf.bmap, block->lf.max) {
+		if (lf >= block->lf.max)
 			break;
 
-		if (block.fn_map[lf] != pcifunc)
+		if (block->fn_map[lf] != pcifunc)
 			continue;
 
 		if (lf == prev_lf + 1) {
@@ -719,7 +719,7 @@ static int get_max_column_width(struct rvu *rvu)
 				if (!strlen(block.name))
 					continue;
 
-				get_lf_str_list(block, pcifunc, buf);
+				get_lf_str_list(&block, pcifunc, buf);
 				if (lf_str_size <= strlen(buf))
 					lf_str_size = strlen(buf) + 1;
 			}
@@ -803,7 +803,7 @@ static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp,
 					continue;
 				len = 0;
 				lfs[len] = '\0';
-				get_lf_str_list(block, pcifunc, lfs);
+				get_lf_str_list(&block, pcifunc, lfs);
 				if (strlen(lfs))
 					flag = 1;
 
Signature · 1 line
2.46.1
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Riyan Dhiman

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.

---
v2: change target branch to net-next and remove fix tag. Compile tested only

#2 lore raw
In reply to Riyan Dhiman
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 1 Oct 2024 16:35:43 +0530 you wrote:

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.

[...]

Here is the summary with links:
- [net-next,v2] octeontx2-af: Change block parameter to const pointer in get_lf_str_list

    https://git.kernel.org/netdev/net-next/c/c55ff46aeebe

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html