staging: use eth_hw_addr_set() for dev->addr_len cases

Convert all staging drivers from memcpy(... dev->addr_len)
to eth_hw_addr_set():

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

Manually confirmed these are all etherdevices.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019171243.1412240-4-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jakub Kicinski 2021-10-19 10:12:38 -07:00 committed by Greg Kroah-Hartman
parent 349f631da4
commit 3928f64b1e
3 changed files with 5 additions and 9 deletions

View File

@ -2490,7 +2490,7 @@ int ks_wlan_set_mac_address(struct net_device *dev, void *addr)
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;
memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); eth_hw_addr_set(dev, mac_addr->sa_data);
ether_addr_copy(priv->eth_addr, mac_addr->sa_data); ether_addr_copy(priv->eth_addr, mac_addr->sa_data);
priv->mac_address_valid = false; priv->mac_address_valid = false;

View File

@ -724,9 +724,7 @@ static int qlge_get_8000_flash_params(struct qlge_adapter *qdev)
goto exit; goto exit;
} }
memcpy(qdev->ndev->dev_addr, eth_hw_addr_set(qdev->ndev, mac_addr);
mac_addr,
qdev->ndev->addr_len);
exit: exit:
qlge_sem_unlock(qdev, SEM_FLASH_MASK); qlge_sem_unlock(qdev, SEM_FLASH_MASK);
@ -774,9 +772,7 @@ static int qlge_get_8012_flash_params(struct qlge_adapter *qdev)
goto exit; goto exit;
} }
memcpy(qdev->ndev->dev_addr, eth_hw_addr_set(qdev->ndev, qdev->flash.flash_params_8012.mac_addr);
qdev->flash.flash_params_8012.mac_addr,
qdev->ndev->addr_len);
exit: exit:
qlge_sem_unlock(qdev, SEM_FLASH_MASK); qlge_sem_unlock(qdev, SEM_FLASH_MASK);
@ -4214,7 +4210,7 @@ static int qlge_set_mac_address(struct net_device *ndev, void *p)
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len); eth_hw_addr_set(ndev, addr->sa_data);
/* Update local copy of current mac address. */ /* Update local copy of current mac address. */
memcpy(qdev->current_mac_addr, ndev->dev_addr, ndev->addr_len); memcpy(qdev->current_mac_addr, ndev->dev_addr, ndev->addr_len);

View File

@ -616,7 +616,7 @@ static int p80211knetdev_set_mac_address(struct net_device *dev, void *addr)
result = -EADDRNOTAVAIL; result = -EADDRNOTAVAIL;
} else { } else {
/* everything's ok, change the addr in netdev */ /* everything's ok, change the addr in netdev */
memcpy(dev->dev_addr, new_addr->sa_data, dev->addr_len); eth_hw_addr_set(dev, new_addr->sa_data);
} }
return result; return result;