RE: [PATCH net-next v5 3/3] net: Convert some ethtool_sprintf() to ethtool_puts()
From: Wei Fang
Date: Thu Dec 07 2023 - 02:20:04 EST
> -----Original Message-----
> From: justinstitt@xxxxxxxxxx <justinstitt@xxxxxxxxxx>
> Sent: 2023年12月7日 7:16
> To: David S. Miller <davem@xxxxxxxxxxxxx>; Eric Dumazet
> <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni
> <pabeni@xxxxxxxxxx>; Shay Agroskin <shayagr@xxxxxxxxxx>; Arthur
> Kiyanovski <akiyano@xxxxxxxxxx>; David Arinzon
> <darinzon@xxxxxxxxxx>; Noam Dagan <ndagan@xxxxxxxxxx>; Saeed
> Bishara <saeedb@xxxxxxxxxx>; Rasesh Mody <rmody@xxxxxxxxxxx>;
> Sudarsana Kalluru <skalluru@xxxxxxxxxxx>; GR-Linux-NIC-Dev@xxxxxxxxxxx;
> Dimitris Michailidis <dmichail@xxxxxxxxxxxx>; Yisen Zhuang
> <yisen.zhuang@xxxxxxxxxx>; Salil Mehta <salil.mehta@xxxxxxxxxx>; Jesse
> Brandeburg <jesse.brandeburg@xxxxxxxxx>; Tony Nguyen
> <anthony.l.nguyen@xxxxxxxxx>; Louis Peens <louis.peens@xxxxxxxxxxxx>;
> Shannon Nelson <shannon.nelson@xxxxxxx>; Brett Creeley
> <brett.creeley@xxxxxxx>; drivers@xxxxxxxxxxx; K. Y. Srinivasan
> <kys@xxxxxxxxxxxxx>; Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>; Wei Liu
> <wei.liu@xxxxxxxxxx>; Dexuan Cui <decui@xxxxxxxxxxxxx>; Ronak Doshi
> <doshir@xxxxxxxxxx>; VMware PV-Drivers Reviewers
> <pv-drivers@xxxxxxxxxx>; Andy Whitcroft <apw@xxxxxxxxxxxxx>; Joe
> Perches <joe@xxxxxxxxxxx>; Dwaipayan Ray <dwaipayanray1@xxxxxxxxx>;
> Lukas Bulwahn <lukas.bulwahn@xxxxxxxxx>; Hauke Mehrtens
> <hauke@xxxxxxxxxx>; Andrew Lunn <andrew@xxxxxxx>; Florian Fainelli
> <f.fainelli@xxxxxxxxx>; Vladimir Oltean <olteanv@xxxxxxxxx>; Arınç ÜNAL
> <arinc.unal@xxxxxxxxxx>; Daniel Golle <daniel@xxxxxxxxxxxxxx>; Landen
> Chao <Landen.Chao@xxxxxxxxxxxx>; DENG Qingfang <dqfext@xxxxxxxxx>;
> Sean Wang <sean.wang@xxxxxxxxxxxx>; Matthias Brugger
> <matthias.bgg@xxxxxxxxx>; AngeloGioacchino Del Regno
> <angelogioacchino.delregno@xxxxxxxxxxxxx>; Linus Walleij
> <linus.walleij@xxxxxxxxxx>; Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>; Wei Fang
> <wei.fang@xxxxxxx>; Shenwei Wang <shenwei.wang@xxxxxxx>; Clark
> Wang <xiaoning.wang@xxxxxxx>; dl-linux-imx <linux-imx@xxxxxxx>; Lars
> Povlsen <lars.povlsen@xxxxxxxxxxxxx>; Steen Hegelund
> <Steen.Hegelund@xxxxxxxxxxxxx>; Daniel Machon
> <daniel.machon@xxxxxxxxxxxxx>; UNGLinuxDriver@xxxxxxxxxxxxx; Jiawen
> Wu <jiawenwu@xxxxxxxxxxxxxx>; Mengyuan Lou
> <mengyuanlou@xxxxxxxxxxxxx>; Heiner Kallweit <hkallweit1@xxxxxxxxx>;
> Russell King <linux@xxxxxxxxxxxxxxx>; Alexei Starovoitov <ast@xxxxxxxxxx>;
> Daniel Borkmann <daniel@xxxxxxxxxxxxx>; Jesper Dangaard Brouer
> <hawk@xxxxxxxxxx>; John Fastabend <john.fastabend@xxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx>; Nathan Chancellor <nathan@xxxxxxxxxx>; Kees
> Cook <keescook@xxxxxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx;
> oss-drivers@xxxxxxxxxxxx; linux-hyperv@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-mediatek@xxxxxxxxxxxxxxxxxxx;
> bpf@xxxxxxxxxxxxxxx; Justin Stitt <justinstitt@xxxxxxxxxx>
> Subject: [PATCH net-next v5 3/3] net: Convert some ethtool_sprintf() to
> ethtool_puts()
>
> This patch converts some basic cases of ethtool_sprintf() to ethtool_puts().
>
> The conversions are used in cases where ethtool_sprintf() was being used
> with just two arguments:
> | ethtool_sprintf(&data, buffer[i].name);
> or when it's used with format string: "%s"
> | ethtool_sprintf(&data, "%s", buffer[i].name);
> which both now become:
> | ethtool_puts(&data, buffer[i].name);
>
> Signed-off-by: Justin Stitt <justinstitt@xxxxxxxxxx>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 4 +-
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index c3b7694a7485..bae9536de767 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2932,10 +2932,10 @@ static void fec_enet_get_strings(struct
> net_device *netdev,
> switch (stringset) {
> case ETH_SS_STATS:
> for (i = 0; i < ARRAY_SIZE(fec_stats); i++) {
> - ethtool_sprintf(&data, "%s", fec_stats[i].name);
> + ethtool_puts(&data, fec_stats[i].name);
> }
> for (i = 0; i < ARRAY_SIZE(fec_xdp_stat_strs); i++) {
> - ethtool_sprintf(&data, "%s", fec_xdp_stat_strs[i]);
> + ethtool_puts(&data, fec_xdp_stat_strs[i]);
> }
> page_pool_ethtool_stats_get_strings(data);
>
Reviewed-by: Wei Fang <wei.fang@xxxxxxx>