staging: use eth_hw_addr_set()

Commit 406f42fa0d ("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 staging drivers from memcpy(... ETH_ADDR) to eth_hw_addr_set():

  @@
  expression dev, np;
  @@
  - memcpy(dev->dev_addr, np, ETH_ALEN)
  + eth_hw_addr_set(dev, np)
  @@
  - memcpy(dev->dev_addr, np, 6)
  + eth_hw_addr_set(dev, np)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-2-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jakub Kicinski 2021-10-19 10:12:36 -07:00 committed by Greg Kroah-Hartman
parent 07e00148a2
commit 6ed178cb23
6 changed files with 7 additions and 7 deletions

View File

@ -175,7 +175,7 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname)
rtw_init_netdev_name(pnetdev, ifname);
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);
if (!rtnl_is_locked())
ret = register_netdev(pnetdev);

View File

@ -406,7 +406,7 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv *dvobj,
rtw_macaddr_cfg(padapter->eeprompriv.mac_addr);
rtw_init_wifidirect_addrs(padapter, padapter->eeprompriv.mac_addr,
padapter->eeprompriv.mac_addr);
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);
DBG_88E("MAC Address from pnetdev->dev_addr = %pM\n",
pnetdev->dev_addr);

View File

@ -2307,7 +2307,7 @@ static int rtl8192_read_eeprom_info(struct net_device *dev)
*(u16 *)(&dev->dev_addr[i]) = (u16)ret;
}
} else {
memcpy(dev->dev_addr, bMac_Tmp_Addr, 6);
eth_hw_addr_set(dev, bMac_Tmp_Addr);
/* should I set IDR0 here? */
}
RT_TRACE(COMP_EPROM, "MAC addr:%pM\n", dev->dev_addr);

View File

@ -381,8 +381,8 @@ static int netdev_open(struct net_device *pnetdev)
goto netdev_open_error;
if (!r8712_initmac) {
/* Use the mac address stored in the Efuse */
memcpy(pnetdev->dev_addr,
padapter->eeprompriv.mac_addr, ETH_ALEN);
eth_hw_addr_set(pnetdev,
padapter->eeprompriv.mac_addr);
} else {
/* We have to inform f/w to use user-supplied MAC
* address.

View File

@ -789,7 +789,7 @@ static int _rtw_drv_register_netdev(struct adapter *padapter, char *name)
if (rtw_init_netdev_name(pnetdev, name))
return _FAIL;
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);
/* Tell the network stack we exist */
if (register_netdev(pnetdev) != 0) {

View File

@ -142,7 +142,7 @@ int rtw_change_ifname(struct adapter *padapter, const char *ifname)
rtw_init_netdev_name(pnetdev, ifname);
memcpy(pnetdev->dev_addr, padapter->eeprompriv.mac_addr, ETH_ALEN);
eth_hw_addr_set(pnetdev, padapter->eeprompriv.mac_addr);
if (!rtnl_is_locked())
ret = register_netdev(pnetdev);