]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ethernet: use device_get_ethdev_address()
authorJakub Kicinski <kuba@kernel.org>
Thu, 7 Oct 2021 01:07:01 +0000 (18:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Oct 2021 12:39:51 +0000 (13:39 +0100)
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>
drivers/net/ethernet/apm/xgene-v2/main.c
drivers/net/ethernet/apm/xgene/xgene_enet_main.c
drivers/net/ethernet/broadcom/genet/bcmgenet.c
drivers/net/ethernet/hisilicon/hns/hns_enet.c

index d1ebd153b7a8fdec530a7c0441ce8882326eacb8..d022b6db9e06617fd556b00830596546a4fd5a32 100644 (file)
@@ -36,7 +36,7 @@ static int xge_get_resources(struct xge_pdata *pdata)
                return -ENOMEM;
        }
 
-       if (device_get_mac_address(dev, ndev->dev_addr))
+       if (device_get_ethdev_address(dev, ndev))
                eth_hw_addr_random(ndev);
 
        memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
index 4a5bf13ffae2ccd0c0344505be91b553feb60ed9..220dc42af31ae1200ca05441000bb2a1abd0fd89 100644 (file)
@@ -1731,7 +1731,7 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
                xgene_get_port_id_acpi(dev, pdata);
 #endif
 
-       if (device_get_mac_address(dev, ndev->dev_addr))
+       if (device_get_ethdev_address(dev, ndev))
                eth_hw_addr_random(ndev);
 
        memcpy(ndev->perm_addr, ndev->dev_addr, ndev->addr_len);
index e61b687d33ba3caa3055eb075a3f38fef8caf4b1..83c55e7b099f6833d13f0fc95b7169205d8abd09 100644 (file)
@@ -4084,7 +4084,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
        if (pd && !IS_ERR_OR_NULL(pd->mac_address))
                eth_hw_addr_set(dev, pd->mac_address);
        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))
                                bcmgenet_get_hw_addr(priv, dev->dev_addr);
 
index 1195f64fb1614a312fd18841bf52c292ecfaf7bd..22a463e15678522cc905fc810995271f44e3c555 100644 (file)
@@ -1212,7 +1212,7 @@ static void hns_init_mac_addr(struct net_device *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);
                dev_warn(priv->dev, "No valid mac, use random mac %pM",
                         ndev->dev_addr);