Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value
@ 2026-07-02  9:49 Krzysztof Kozlowski
  2026-07-02  9:49 ` [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set() Krzysztof Kozlowski
  2026-07-03  8:07 ` [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Jie Luo
  0 siblings, 2 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-02  9:49 UTC (permalink / raw)
  To: Luo Jie, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: 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".

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/net/ethernet/qualcomm/ppe/ppe_config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/ppe/ppe_config.c b/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
index e9a0e22907a6..94f69c077949 100644
--- a/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
+++ b/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
@@ -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;
-- 
2.53.0


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

* [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set()
  2026-07-02  9:49 [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Krzysztof Kozlowski
@ 2026-07-02  9:49 ` Krzysztof Kozlowski
  2026-07-03  8:06   ` Jie Luo
  2026-07-03  8:07 ` [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Jie Luo
  1 sibling, 1 reply; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-02  9:49 UTC (permalink / raw)
  To: Luo Jie, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel
  Cc: 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.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 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(-)

diff --git a/drivers/net/ethernet/qualcomm/ppe/ppe_config.c b/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
index 94f69c077949..125b73be92b1 100644
--- a/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
+++ b/drivers/net/ethernet/qualcomm/ppe/ppe_config.c
@@ -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];
 
diff --git a/drivers/net/ethernet/qualcomm/ppe/ppe_config.h b/drivers/net/ethernet/qualcomm/ppe/ppe_config.h
index 4bb45ca40144..60493e51e0a4 100644
--- a/drivers/net/ethernet/qualcomm/ppe/ppe_config.h
+++ b/drivers/net/ethernet/qualcomm/ppe/ppe_config.h
@@ -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
-- 
2.53.0


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

* Re: [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set()
  2026-07-02  9:49 ` [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set() Krzysztof Kozlowski
@ 2026-07-03  8:06   ` Jie Luo
  0 siblings, 0 replies; 4+ messages in thread
From: Jie Luo @ 2026-07-03  8:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel



On 7/2/2026 5:49 PM, Krzysztof Kozlowski wrote:
> "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.
Reviewed-by: Luo Jie <jie.luo@oss.qualcomm.com>

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

* Re: [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value
  2026-07-02  9:49 [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Krzysztof Kozlowski
  2026-07-02  9:49 ` [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set() Krzysztof Kozlowski
@ 2026-07-03  8:07 ` Jie Luo
  1 sibling, 0 replies; 4+ messages in thread
From: Jie Luo @ 2026-07-03  8:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel



On 7/2/2026 5:49 PM, Krzysztof Kozlowski 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".

Reviewed-by: Luo Jie <jie.luo@oss.qualcomm.com>

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

end of thread, other threads:[~2026-07-03  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  9:49 [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Krzysztof Kozlowski
2026-07-02  9:49 ` [PATCH net-next 2/2] net: ethernet: qualcomm: Constify "queue_map" in ppe_ring_queue_map_set() Krzysztof Kozlowski
2026-07-03  8:06   ` Jie Luo
2026-07-03  8:07 ` [PATCH net-next 1/2] net: ethernet: qualcomm: Unconstify function arguments passed by value Jie Luo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox