Skip to contentSkip to conversation

net: ethernet: qualcomm: Unconstify function arguments passed by value

PATCH Applied Krzysztof Kozlowski 3 participants 5 messages Jul 2 – Jul 7

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

PATCH 1/2 net: ethernet: qualcomm: Unconstify function arguments passed by value

There is no benefit in marking "const" a pass-by-value (not a pointer) function argument, because it is passed as a copy on the stack. No code readability improvements, no additional compiler-time safety for misuse. Drop such redundant "const".

---
 drivers/net/ethernet/qualcomm/ppe/ppe_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/ppe/ppe_config.c +2 -2
index e9a0e22907a6..94f69c077949 100644
@@ -1380,7 +1380,7 @@ int ppe_ring_queue_map_set(struct ppe_device *ppe_dev, int ring_id, u32 *queue_m
 }
 
 static int ppe_config_bm_threshold(struct ppe_device *ppe_dev, int bm_port_id,
-				   const struct ppe_bm_port_config port_cfg)
+				   struct ppe_bm_port_config port_cfg)
 {
 	u32 reg, val, bm_fc_val[2];
 	int ret;
@@ -1586,7 +1586,7 @@ static int ppe_config_qm(struct ppe_device *ppe_dev)
 }
 
 static int ppe_node_scheduler_config(struct ppe_device *ppe_dev,
-				     const struct ppe_scheduler_port_config config)
+				     struct ppe_scheduler_port_config config)
 {
 	struct ppe_scheduler_cfg sch_cfg;
 	int ret, i;
Signature · 1 line
2.53.0
#1 lore raw

PATCH 2/2 net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set()

"queue_map" is a pointer to "u32" and is not modified by the ppe_ring_queue_map_set() function, thus can be made a pointer to const to indicate that function is treating the pointed value read-only. This in general makes the code easier to follow and a bit safer.

---
 drivers/net/ethernet/qualcomm/ppe/ppe_config.c | 3 ++-
 drivers/net/ethernet/qualcomm/ppe/ppe_config.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/qualcomm/ppe/ppe_config.c +2 -1
index 94f69c077949..125b73be92b1 100644
@@ -1367,7 +1367,8 @@ int ppe_rss_hash_config_set(struct ppe_device *ppe_dev, int mode,
  *
  * Return: 0 on success, negative error code on failure.
  */
-int ppe_ring_queue_map_set(struct ppe_device *ppe_dev, int ring_id, u32 *queue_map)
+int ppe_ring_queue_map_set(struct ppe_device *ppe_dev, int ring_id,
+			   const u32 *queue_map)
 {
 	u32 reg, queue_bitmap_val[PPE_RING_TO_QUEUE_BITMAP_WORD_CNT];
 
drivers/net/ethernet/qualcomm/ppe/ppe_config.h +1 -1
index 4bb45ca40144..60493e51e0a4 100644
@@ -313,5 +313,5 @@ int ppe_rss_hash_config_set(struct ppe_device *ppe_dev, int mode,
 			    struct ppe_rss_hash_cfg hash_cfg);
 int ppe_ring_queue_map_set(struct ppe_device *ppe_dev,
 			   int ring_id,
-			   u32 *queue_map);
+			   const u32 *queue_map);
 #endif
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set()

Quoted 4 lines · Krzysztof Kozlowski

"queue_map" is a pointer to "u32" and is not modified by the ppe_ring_queue_map_set() function, thus can be made a pointer to const to indicate that function is treating the pointed value read-only. This in general makes the code easier to follow and a bit safer.

Thanks for this improvement.

maintainer Reviewed-by on v1 1/2
#3 lore raw
In reply to Krzysztof Kozlowski
Quoted 4 lines · Krzysztof Kozlowski

There is no benefit in marking "const" a pass-by-value (not a pointer) function argument, because it is passed as a copy on the stack. No code readability improvements, no additional compiler-time safety for misuse. Drop such redundant "const".

#4 lore raw
In reply to Krzysztof Kozlowski
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Thu, 2 Jul 2026 11:49:09 +0200 you wrote:

There is no benefit in marking "const" a pass-by-value (not a pointer) function argument, because it is passed as a copy on the stack. No code readability improvements, no additional compiler-time safety for misuse. Drop such redundant "const".

[...]

Here is the summary with links:
- [net-next,1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value

    https://git.kernel.org/netdev/net-next/c/e0421c6fd39d
  - [net-next,2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set()
    https://git.kernel.org/netdev/net-next/c/cefd16657c1d

You are awesome, thank you!

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