summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/gianfar_ethtool.c
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2024-10-25 22:37:57 +0200
committerJakub Kicinski <kuba@kernel.org>2024-11-01 02:34:48 +0100
commitf611cc38925bec1bf530fd03c1e57b21ca82c4d8 (patch)
tree3fdff66b78e92a9a48690862ce5757d0265a96b7 /drivers/net/ethernet/freescale/gianfar_ethtool.c
parenttcp: only release congestion control if it has been initialized (diff)
downloadlinux-f611cc38925bec1bf530fd03c1e57b21ca82c4d8.tar.xz
linux-f611cc38925bec1bf530fd03c1e57b21ca82c4d8.zip
net: freescale: use ethtool string helpers
The latter is the preferred way to copy ethtool strings. Avoids manually incrementing the pointer. Cleans up the code quite well. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Lee Trager <lee@trager.us> Link: https://patch.msgid.link/20241025203757.288367-1-rosenp@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/freescale/gianfar_ethtool.c')
-rw-r--r--drivers/net/ethernet/freescale/gianfar_ethtool.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index a99b95c4bcfb..781d92e703cb 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -115,12 +115,14 @@ static const char stat_gstrings[][ETH_GSTRING_LEN] = {
static void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
{
struct gfar_private *priv = netdev_priv(dev);
+ int i;
if (priv->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
- memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
+ for (i = 0; i < GFAR_STATS_LEN; i++)
+ ethtool_puts(&buf, stat_gstrings[i]);
else
- memcpy(buf, stat_gstrings,
- GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
+ for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
+ ethtool_puts(&buf, stat_gstrings[i]);
}
/* Fill in an array of 64-bit statistics from various sources.