[OpenWrt-Devel] [PATCH 5/5] net: ethernet: mediatek: enhance with avoiding superfluous assignment inside mtk_get_ethtool_stats

Rosen Penev rosenp at gmail.com
Wed Jul 4 19:20:08 EDT 2018


From: Sean Wang <sean.wang at mediatek.com>

data_src is unchanged inside the loop, so this patch moves
the assignment to outside the loop to avoid unnecessarily
assignment

Signed-off-by: Sean Wang <sean.wang at mediatek.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
---
 .../ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c
index 5732c28536..edadf4fc30 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/ethtool.c
@@ -192,8 +192,9 @@ static void fe_get_ethtool_stats(struct net_device *dev,
 		}
 	}
 
+	data_src = &hwstats->tx_bytes;
+
 	do {
-		data_src = &hwstats->tx_bytes;
 		data_dst = data;
 		start = u64_stats_fetch_begin_irq(&hwstats->syncp);
 
-- 
2.17.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list