[PATCH] net: mvneta: use ethtool_puts

Rosen Penev posted 1 patch 1 month, 2 weeks ago
drivers/net/ethernet/marvell/mvneta.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] net: mvneta: use ethtool_puts
Posted by Rosen Penev 1 month, 2 weeks ago
Allows simplifying get_strings and avoids manual pointer manipulation.

Tested on Turris Omnia.

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

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index fcd89c67094f..7bb781fb93b5 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4795,11 +4795,9 @@ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
 		int i;
 
 		for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
-			memcpy(data + i * ETH_GSTRING_LEN,
-			       mvneta_statistics[i].name, ETH_GSTRING_LEN);
+			ethtool_puts(&data, mvneta_statistics[i].name);
 
 		if (!pp->bm_priv) {
-			data += ETH_GSTRING_LEN * ARRAY_SIZE(mvneta_statistics);
 			page_pool_ethtool_stats_get_strings(data);
 		}
 	}
-- 
2.47.0
Re: [PATCH] net: mvneta: use ethtool_puts
Posted by Gerhard Engleder 1 month, 2 weeks ago

On 11.10.24 21:59, Rosen Penev wrote:
> Allows simplifying get_strings and avoids manual pointer manipulation.
> 
> Tested on Turris Omnia.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>   drivers/net/ethernet/marvell/mvneta.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index fcd89c67094f..7bb781fb93b5 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -4795,11 +4795,9 @@ static void mvneta_ethtool_get_strings(struct net_device *netdev, u32 sset,
>   		int i;
>   
>   		for (i = 0; i < ARRAY_SIZE(mvneta_statistics); i++)
> -			memcpy(data + i * ETH_GSTRING_LEN,
> -			       mvneta_statistics[i].name, ETH_GSTRING_LEN);
> +			ethtool_puts(&data, mvneta_statistics[i].name);
>   
>   		if (!pp->bm_priv) {
> -			data += ETH_GSTRING_LEN * ARRAY_SIZE(mvneta_statistics);

Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>