[PATCH net-next] net: mv643xx: use ethtool_puts

Rosen Penev posted 1 patch 1 month, 1 week ago
drivers/net/ethernet/marvell/mv643xx_eth.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
[PATCH net-next] net: mv643xx: use ethtool_puts
Posted by Rosen Penev 1 month, 1 week ago
Allows simplifying get_strings and avoids manual pointer manipulation.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 4abd3ebcdbd6..a06048719e84 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -1698,13 +1698,9 @@ static void mv643xx_eth_get_strings(struct net_device *dev,
 {
 	int i;
 
-	if (stringset == ETH_SS_STATS) {
-		for (i = 0; i < ARRAY_SIZE(mv643xx_eth_stats); i++) {
-			memcpy(data + i * ETH_GSTRING_LEN,
-				mv643xx_eth_stats[i].stat_string,
-				ETH_GSTRING_LEN);
-		}
-	}
+	if (stringset == ETH_SS_STATS)
+		for (i = 0; i < ARRAY_SIZE(mv643xx_eth_stats); i++)
+			ethtool_puts(&data, mv643xx_eth_stats[i].stat_string);
 }
 
 static void mv643xx_eth_get_ethtool_stats(struct net_device *dev,
-- 
2.47.0
Re: [PATCH net-next] net: mv643xx: use ethtool_puts
Posted by Kalesh Anakkur Purayil 1 month ago
On Sat, Oct 19, 2024 at 1:35 AM Rosen Penev <rosenp@gmail.com> wrote:
>
> Allows simplifying get_strings and avoids manual pointer manipulation.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

LGTM
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>


-- 
Regards,
Kalesh A P
Re: [PATCH net-next] net: mv643xx: use ethtool_puts
Posted by Andrew Lunn 1 month ago
On Fri, Oct 18, 2024 at 01:05:22PM -0700, Rosen Penev wrote:
> Allows simplifying get_strings and avoids manual pointer manipulation.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

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

    Andrew