Message ID | 20241011200225.7403-1-rosenp@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | net: mtk_eth_soc: use ethtool_puts | expand |
On 11.10.24 22:02, Rosen Penev wrote: > Allows simplifying get_strings and avoids manual pointer manipulation. > > Tested on Belkin RT1800. > > Signed-off-by: Rosen Penev <rosenp@gmail.com> > --- > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > index 9aaaaa2a27dc..6d93f64f8748 100644 > --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c > +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c > @@ -4328,10 +4328,8 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data) > case ETH_SS_STATS: { > struct mtk_mac *mac = netdev_priv(dev); > > - for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) { > - memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN); > - data += ETH_GSTRING_LEN; > - } > + for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) > + ethtool_puts(&data, mtk_ethtool_stats[i].str); Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Fri, 11 Oct 2024 13:02:25 -0700 you wrote: > Allows simplifying get_strings and avoids manual pointer manipulation. > > Tested on Belkin RT1800. > > Signed-off-by: Rosen Penev <rosenp@gmail.com> > --- > drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) Here is the summary with links: - net: mtk_eth_soc: use ethtool_puts https://git.kernel.org/netdev/net-next/c/2a22bead433e You are awesome, thank you!
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 9aaaaa2a27dc..6d93f64f8748 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -4328,10 +4328,8 @@ static void mtk_get_strings(struct net_device *dev, u32 stringset, u8 *data) case ETH_SS_STATS: { struct mtk_mac *mac = netdev_priv(dev); - for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) { - memcpy(data, mtk_ethtool_stats[i].str, ETH_GSTRING_LEN); - data += ETH_GSTRING_LEN; - } + for (i = 0; i < ARRAY_SIZE(mtk_ethtool_stats); i++) + ethtool_puts(&data, mtk_ethtool_stats[i].str); if (mtk_page_pool_enabled(mac->hw)) page_pool_ethtool_stats_get_strings(data); break;
Allows simplifying get_strings and avoids manual pointer manipulation. Tested on Belkin RT1800. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)