Re: [PATCHv2 net-next] net: dsa: use ethtool string helpers

From: Geert Uytterhoeven
Date: Wed Oct 23 2024 - 03:48:05 EST


Hi Rosen,

On Tue, Oct 22, 2024 at 10:16 PM Rosen Penev <rosenp@xxxxxxxxx> wrote:
> These are the prefered way to copy ethtool strings.
>
> Avoids incrementing pointers all over the place.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> Reviewed-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx>
> ---
> v2: remove curly braces from rzn1_a5psw.c

Thanks for the update!

> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -2113,8 +2113,7 @@ static void ksz_get_strings(struct dsa_switch *ds, int port,
> return;
>
> for (i = 0; i < dev->info->mib_cnt; i++) {
> - memcpy(buf + i * ETH_GSTRING_LEN,
> - dev->info->mib_names[i].string, ETH_GSTRING_LEN);
> + ethtool_puts(&buf, dev->info->mib_names[i].string);
> }

This location could benefit from a similar change.

> }
>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds