Commit af804e6d authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

net: usb: use eth_hw_addr_set() instead of ether_addr_copy()

Commit 406f42fa ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.

Convert net/usb from ether_addr_copy() to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - ether_addr_copy(dev->dev_addr, np)
  + eth_hw_addr_set(dev, np)
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f3956ebb
...@@ -714,7 +714,7 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf) ...@@ -714,7 +714,7 @@ static int aqc111_bind(struct usbnet *dev, struct usb_interface *intf)
if (ret) if (ret)
goto out; goto out;
ether_addr_copy(dev->net->dev_addr, dev->net->perm_addr); eth_hw_addr_set(dev->net, dev->net->perm_addr);
/* Set Rx urb size */ /* Set Rx urb size */
dev->rx_urb_size = URB_SIZE; dev->rx_urb_size = URB_SIZE;
......
...@@ -1817,7 +1817,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev) ...@@ -1817,7 +1817,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
lan78xx_write_reg(dev, MAF_LO(0), addr_lo); lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_); lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
ether_addr_copy(dev->net->dev_addr, addr); eth_hw_addr_set(dev->net, addr);
} }
/* MDIO read and write wrappers for phylib */ /* MDIO read and write wrappers for phylib */
...@@ -2416,7 +2416,7 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p) ...@@ -2416,7 +2416,7 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p)
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
ether_addr_copy(netdev->dev_addr, addr->sa_data); eth_hw_addr_set(netdev, addr->sa_data);
addr_lo = netdev->dev_addr[0] | addr_lo = netdev->dev_addr[0] |
netdev->dev_addr[1] << 8 | netdev->dev_addr[1] << 8 |
......
...@@ -1718,7 +1718,7 @@ static int set_ethernet_addr(struct r8152 *tp, bool in_resume) ...@@ -1718,7 +1718,7 @@ static int set_ethernet_addr(struct r8152 *tp, bool in_resume)
return ret; return ret;
if (tp->version == RTL_VER_01) if (tp->version == RTL_VER_01)
ether_addr_copy(dev->dev_addr, sa.sa_data); eth_hw_addr_set(dev, sa.sa_data);
else else
ret = __rtl8152_set_mac_address(dev, &sa, in_resume); ret = __rtl8152_set_mac_address(dev, &sa, in_resume);
......
...@@ -421,7 +421,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags) ...@@ -421,7 +421,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
if (bp[0] & 0x02) if (bp[0] & 0x02)
eth_hw_addr_random(net); eth_hw_addr_random(net);
else else
ether_addr_copy(net->dev_addr, bp); eth_hw_addr_set(net, bp);
/* set a nonzero filter to enable data transfers */ /* set a nonzero filter to enable data transfers */
memset(u.set, 0, sizeof *u.set); memset(u.set, 0, sizeof *u.set);
......
...@@ -262,7 +262,7 @@ static void set_ethernet_addr(rtl8150_t *dev) ...@@ -262,7 +262,7 @@ static void set_ethernet_addr(rtl8150_t *dev)
ret = get_registers(dev, IDR, sizeof(node_id), node_id); ret = get_registers(dev, IDR, sizeof(node_id), node_id);
if (!ret) { if (!ret) {
ether_addr_copy(dev->netdev->dev_addr, node_id); eth_hw_addr_set(dev->netdev, node_id);
} else { } else {
eth_hw_addr_random(dev->netdev); eth_hw_addr_random(dev->netdev);
netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n", netdev_notice(dev->netdev, "Assigned a random MAC address: %pM\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment