Re: [PATCH net-next] net: bnxt: use ethtool string helpers
From: Michael Chan
Date: Mon Oct 21 2024 - 16:26:24 EST
On Sun, Oct 20, 2024 at 7:29 PM Rosen Penev <rosenp@xxxxxxxxx> wrote:
>
> Avoids having to use manual pointer manipulation.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
> ---
> .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 110 ++++++++----------
> 1 file changed, 50 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> index f71cc8188b4e..84d468ad3c8e 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> @@ -713,18 +713,17 @@ static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
> for (i = 0; i < bp->cp_nr_rings; i++) {
> if (is_rx_ring(bp, i)) {
> num_str = NUM_RING_RX_HW_STATS;
> - for (j = 0; j < num_str; j++) {
> - sprintf(buf, "[%d]: %s", i,
> + for (j = 0; j < num_str; j++)
> + ethtool_sprintf(
> + &buf, "[%d]: %s", i,
If you combine this line with the line above, I think it will look better:
ethtool_sprintf(&buf, "[%d]: %s", i,
checkpatch.pl may warn because the next line won't line up, but I
think it will look better and it reduces the number of lines. The
same comment applies to other similar spots in the patch. Thanks.
> bnxt_ring_rx_stats_str[j]);
> - buf += ETH_GSTRING_LEN;
> - }
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature