[PATCH -next] net/ps3_gelic_net: Use ether_addr_to_u64() to convert ethernet address

Li Zetao lizetao1 at huawei.com
Tue Aug 8 21:40:50 AEST 2023


Use ether_addr_to_u64() to convert an Ethernet address into a u64 value,
instead of directly calculating, as this is exactly what
this function does.

Signed-off-by: Li Zetao <lizetao1 at huawei.com>
---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index 9d535ae59626..77a02819e412 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -596,7 +596,6 @@ void gelic_net_set_multi(struct net_device *netdev)
 	struct gelic_card *card = netdev_card(netdev);
 	struct netdev_hw_addr *ha;
 	unsigned int i;
-	uint8_t *p;
 	u64 addr;
 	int status;
 
@@ -629,12 +628,7 @@ void gelic_net_set_multi(struct net_device *netdev)
 
 	/* set multicast addresses */
 	netdev_for_each_mc_addr(ha, netdev) {
-		addr = 0;
-		p = ha->addr;
-		for (i = 0; i < ETH_ALEN; i++) {
-			addr <<= 8;
-			addr |= *p++;
-		}
+		addr = ether_addr_to_u64(ha->addr);
 		status = lv1_net_add_multicast_address(bus_id(card),
 						       dev_id(card),
 						       addr, 0);
-- 
2.34.1



More information about the Linuxppc-dev mailing list