ethernet: use device_get_ethdev_address()

Use the new device_get_ethdev_address() helper for the cases
where dev->dev_addr is passed in directly as the destination.

  @@
  expression dev, np;
  @@
  - device_get_mac_address(np, dev->dev_addr, ETH_ALEN)
  + device_get_ethdev_address(np, dev)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jakub Kicinski 2021-10-06 18:07:01 -07:00 committed by David S. Miller
parent d9eb44904e
commit b8eeac565b
4 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ static int xge_get_resources(struct xge_pdata *pdata)
return -ENOMEM; return -ENOMEM;
} }
if (device_get_mac_address(dev, ndev->dev_addr)) if (device_get_ethdev_address(dev, ndev))
eth_hw_addr_random(ndev); eth_hw_addr_random(ndev);
memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);

View File

@ -1731,7 +1731,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
xgene_get_port_id_acpi(dev, pdata); xgene_get_port_id_acpi(dev, pdata);
#endif #endif
if (device_get_mac_address(dev, ndev->dev_addr)) if (device_get_ethdev_address(dev, ndev))
eth_hw_addr_random(ndev); eth_hw_addr_random(ndev);
memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len); memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);

View File

@ -4084,7 +4084,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
if (pd && !IS_ERR_OR_NULL(pd->mac_address)) if (pd && !IS_ERR_OR_NULL(pd->mac_address))
eth_hw_addr_set(dev, pd->mac_address); eth_hw_addr_set(dev, pd->mac_address);
else else
if (device_get_mac_address(&pdev->dev, dev->dev_addr)) if (device_get_ethdev_address(&pdev->dev, dev))
if (has_acpi_companion(&pdev->dev)) if (has_acpi_companion(&pdev->dev))
bcmgenet_get_hw_addr(priv, dev->dev_addr); bcmgenet_get_hw_addr(priv, dev->dev_addr);

View File

@ -1212,7 +1212,7 @@ static void hns_init_mac_addr(struct net_device *ndev)
{ {
struct hns_nic_priv *priv = netdev_priv(ndev); struct hns_nic_priv *priv = netdev_priv(ndev);
if (device_get_mac_address(priv->dev, ndev->dev_addr)) { if (device_get_ethdev_address(priv->dev, ndev)) {
eth_hw_addr_random(ndev); eth_hw_addr_random(ndev);
dev_warn(priv->dev, "No valid mac, use random mac %pM", dev_warn(priv->dev, "No valid mac, use random mac %pM",
ndev->dev_addr); ndev->dev_addr);