[PATCH][next][V2] net: dsa: rzn1_a5psw: Make the read-only array offsets static const

Colin Ian King posted 1 patch 8 months ago
drivers/net/dsa/rzn1_a5psw.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH][next][V2] net: dsa: rzn1_a5psw: Make the read-only array offsets static const
Posted by Colin Ian King 8 months ago
Don't populate the read-only array offsets on the stack at run time,
instead make it static const.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---

V2: Fix commit message

---
 drivers/net/dsa/rzn1_a5psw.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 31ea8130a495..df7466d4fe8f 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -337,8 +337,9 @@ static void a5psw_port_rx_block_set(struct a5psw *a5psw, int port, bool block)
 static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port,
 					  bool set)
 {
-	u8 offsets[] = {A5PSW_UCAST_DEF_MASK, A5PSW_BCAST_DEF_MASK,
-			A5PSW_MCAST_DEF_MASK};
+	static const u8 offsets[] = {
+		A5PSW_UCAST_DEF_MASK, A5PSW_BCAST_DEF_MASK, A5PSW_MCAST_DEF_MASK
+	};
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(offsets); i++)
-- 
2.49.0
Re: [PATCH][next][V2] net: dsa: rzn1_a5psw: Make the read-only array offsets static const
Posted by Wolfram Sang 7 months, 4 weeks ago
On Thu, Apr 17, 2025 at 05:13:52PM +0100, Colin Ian King wrote:
> Don't populate the read-only array offsets on the stack at run time,
> instead make it static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Works on my RZ/N1D-DB + EB.

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Re: [PATCH][next][V2] net: dsa: rzn1_a5psw: Make the read-only array offsets static const
Posted by Andrew Lunn 8 months ago
On Thu, Apr 17, 2025 at 05:13:52PM +0100, Colin Ian King wrote:
> Don't populate the read-only array offsets on the stack at run time,
> instead make it static const.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew