]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ethernet: use of_get_ethdev_address()
authorJakub Kicinski <kuba@kernel.org>
Thu, 7 Oct 2021 01:06:56 +0000 (18:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Oct 2021 12:39:51 +0000 (13:39 +0100)
Use the new of_get_ethdev_address() helper for the cases
where dev->dev_addr is passed in directly as the destination.

  @@
  expression dev, np;
  @@
  - of_get_mac_address(np, dev->dev_addr)
  + of_get_ethdev_address(np, dev)

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
34 files changed:
drivers/net/ethernet/allwinner/sun4i-emac.c
drivers/net/ethernet/altera/altera_tse_main.c
drivers/net/ethernet/arc/emac_main.c
drivers/net/ethernet/atheros/ag71xx.c
drivers/net/ethernet/broadcom/bcm4908_enet.c
drivers/net/ethernet/broadcom/bcmsysport.c
drivers/net/ethernet/broadcom/bgmac-bcma.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
drivers/net/ethernet/ethoc.c
drivers/net/ethernet/ezchip/nps_enet.c
drivers/net/ethernet/freescale/fec_mpc52xx.c
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/freescale/ucc_geth.c
drivers/net/ethernet/hisilicon/hisi_femac.c
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
drivers/net/ethernet/korina.c
drivers/net/ethernet/lantiq_xrx200.c
drivers/net/ethernet/litex/litex_liteeth.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/marvell/sky2.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/micrel/ks8851_common.c
drivers/net/ethernet/nxp/lpc_eth.c
drivers/net/ethernet/qualcomm/qca_spi.c
drivers/net/ethernet/qualcomm/qca_uart.c
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
drivers/net/ethernet/socionext/sni_ave.c
drivers/net/ethernet/ti/netcp_core.c
drivers/net/ethernet/xilinx/xilinx_emaclite.c

index 40b8138349b7d90ded90fbacdb169a2951c70138..800ee022388fd56d812986265b09de071c4f177c 100644 (file)
@@ -852,7 +852,7 @@ static int emac_probe(struct platform_device *pdev)
        }
 
        /* Read MAC-address from DT */
-       ret = of_get_mac_address(np, ndev->dev_addr);
+       ret = of_get_ethdev_address(np, ndev);
        if (ret) {
                /* if the MAC address is invalid get a random one */
                eth_hw_addr_random(ndev);
index 1c00d719e5d7669663bf7ac065bd0dfe1691eaf4..7b75b0cd7ac92654874bfff5f29ea72f139f08ce 100644 (file)
@@ -1524,7 +1524,7 @@ static int altera_tse_probe(struct platform_device *pdev)
        priv->rx_dma_buf_sz = ALTERA_RXDMABUFFER_SIZE;
 
        /* get default MAC address from device tree */
-       ret = of_get_mac_address(pdev->dev.of_node, ndev->dev_addr);
+       ret = of_get_ethdev_address(pdev->dev.of_node, ndev);
        if (ret)
                eth_hw_addr_random(ndev);
 
index 215b5144b88515c7aaa67af1e9b2aaf1ebe2d852..c642c3d3e600606f281ec4819533702276c335fe 100644 (file)
@@ -941,7 +941,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
        }
 
        /* Get MAC address from device tree */
-       err = of_get_mac_address(dev->of_node, ndev->dev_addr);
+       err = of_get_ethdev_address(dev->of_node, ndev);
        if (err)
                eth_hw_addr_random(ndev);
 
index 02ae98aabf91c87e91f63e5010e85bd5f08a9ff1..1aaaf8a4e7c527bccbee24d99d85b01d83fd9290 100644 (file)
@@ -1968,7 +1968,7 @@ static int ag71xx_probe(struct platform_device *pdev)
        ag->stop_desc->ctrl = 0;
        ag->stop_desc->next = (u32)ag->stop_desc_dma;
 
-       err = of_get_mac_address(np, ndev->dev_addr);
+       err = of_get_ethdev_address(np, ndev);
        if (err) {
                netif_err(ag, probe, ndev, "invalid MAC address, using random address\n");
                eth_random_addr(ndev->dev_addr);
index 02a569500234cd08c25d16e5a56c728d51af9b45..aa3b5672eab20cce4ca8e3b7971e16afe1da41bd 100644 (file)
@@ -715,7 +715,7 @@ static int bcm4908_enet_probe(struct platform_device *pdev)
                return err;
 
        SET_NETDEV_DEV(netdev, &pdev->dev);
-       err = of_get_mac_address(dev->of_node, netdev->dev_addr);
+       err = of_get_ethdev_address(dev->of_node, netdev);
        if (err)
                eth_hw_addr_random(netdev);
        netdev->netdev_ops = &bcm4908_enet_netdev_ops;
index 0c34bef1a431101338b6de83c55b9626a819b2e8..b813745e8de34967f2cec64b3d787e0146b63b77 100644 (file)
@@ -2555,7 +2555,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
        }
 
        /* Initialize netdevice members */
-       ret = of_get_mac_address(dn, dev->dev_addr);
+       ret = of_get_ethdev_address(dn, dev);
        if (ret) {
                dev_warn(&pdev->dev, "using random Ethernet MAC\n");
                eth_hw_addr_random(dev);
index 7190e3f0da912d45d176d328dc1c3d7033749aa0..e6f48786949c0fb5ed7db717df15db4fb622feb2 100644 (file)
@@ -140,7 +140,7 @@ static int bgmac_probe(struct bcma_device *core)
 
        bcma_set_drvdata(core, bgmac);
 
-       err = of_get_mac_address(bgmac->dev->of_node, bgmac->net_dev->dev_addr);
+       err = of_get_ethdev_address(bgmac->dev->of_node, bgmac->net_dev);
        if (err == -EPROBE_DEFER)
                return err;
 
index df8ff839cc62142cf7b2b94a11b76a5860c6306c..c6412c523637b9bd5cfab69cae556dc407d8b7a6 100644 (file)
@@ -191,7 +191,7 @@ static int bgmac_probe(struct platform_device *pdev)
        bgmac->dev = &pdev->dev;
        bgmac->dma_dev = &pdev->dev;
 
-       ret = of_get_mac_address(np, bgmac->net_dev->dev_addr);
+       ret = of_get_ethdev_address(np, bgmac->net_dev);
        if (ret == -EPROBE_DEFER)
                return ret;
 
index b58297aeb793d98d5a0eb259fc8fff41d30abba0..683f14665c2c0c4fbb3dd0911a8de1f911cbd2d7 100644 (file)
@@ -4774,7 +4774,7 @@ static int macb_probe(struct platform_device *pdev)
        if (bp->caps & MACB_CAPS_NEEDS_RSTONUBR)
                bp->rx_intr_mask |= MACB_BIT(RXUBR);
 
-       err = of_get_mac_address(np, bp->dev->dev_addr);
+       err = of_get_ethdev_address(np, bp->dev);
        if (err == -EPROBE_DEFER)
                goto err_out_free_netdev;
        else if (err)
index 30463a6d1f8c998ec654fd7bcd938529444580ff..4e39d712e121e5b3887bcbda16bbca6bc52fb95c 100644 (file)
@@ -1501,7 +1501,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
        netdev->min_mtu = 64 - OCTEON_MGMT_RX_HEADROOM;
        netdev->max_mtu = 16383 - OCTEON_MGMT_RX_HEADROOM - VLAN_HLEN;
 
-       result = of_get_mac_address(pdev->dev.of_node, netdev->dev_addr);
+       result = of_get_ethdev_address(pdev->dev.of_node, netdev);
        if (result)
                eth_hw_addr_random(netdev);
 
index 7eb7d28a489df5c72933d7f9c44393bcda2fd2c6..cd3a3b8f23b69b4658eae276ab91453a28023f4a 100644 (file)
@@ -1147,7 +1147,7 @@ static int ethoc_probe(struct platform_device *pdev)
                eth_hw_addr_set(netdev, pdata->hwaddr);
                priv->phy_id = pdata->phy_id;
        } else {
-               of_get_mac_address(pdev->dev.of_node, netdev->dev_addr);
+               of_get_ethdev_address(pdev->dev.of_node, netdev);
                priv->phy_id = -1;
        }
 
index f5935eb5a791c3c165c6ff5d6a4f04c5ca9927bd..323340826dabdc143b82c82f56337290c2ea8bf2 100644 (file)
@@ -601,7 +601,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
        dev_dbg(dev, "Registers base address is 0x%p\n", priv->regs_base);
 
        /* set kernel MAC address to dev */
-       err = of_get_mac_address(dev->of_node, ndev->dev_addr);
+       err = of_get_ethdev_address(dev->of_node, ndev);
        if (err)
                eth_hw_addr_random(ndev);
 
index 5e418850d32df74b5c3cd7d48397aacaab78fcf4..bbbde9f701c27a7ca82268f8259f3e81b36c9704 100644 (file)
@@ -890,7 +890,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
         *
         * First try to read MAC address from DT
         */
-       rv = of_get_mac_address(np, ndev->dev_addr);
+       rv = of_get_ethdev_address(np, ndev);
        if (rv) {
                struct mpc52xx_fec __iomem *fec = priv->fec;
 
index 2db6e38a772e7df1c1380afae2a3a8e2ef128ff3..bacf25318f87aee1f91aad9b05cb688cd52f3ce0 100644 (file)
@@ -1005,7 +1005,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
        spin_lock_init(&fep->lock);
        spin_lock_init(&fep->tx_lock);
 
-       of_get_mac_address(ofdev->dev.of_node, ndev->dev_addr);
+       of_get_ethdev_address(ofdev->dev.of_node, ndev);
 
        ret = fep->ops->allocate_bd(ndev);
        if (ret)
index af6ad94bf24a47ff421ca423e833484086069ea9..acab58fd3db38cfb22f31610922c5f0c0d398ba8 100644 (file)
@@ -753,7 +753,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
        if (stash_len || stash_idx)
                priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
 
-       err = of_get_mac_address(np, dev->dev_addr);
+       err = of_get_ethdev_address(np, dev);
        if (err) {
                eth_hw_addr_random(dev);
                dev_info(&ofdev->dev, "Using random MAC address: %pM\n", dev->dev_addr);
index e84517a4d2458f0fff6dd14e5354c516f6d75de9..823221c912ab13161954793949596cb07eaabf7f 100644 (file)
@@ -3731,7 +3731,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
                goto err_free_netdev;
        }
 
-       of_get_mac_address(np, dev->dev_addr);
+       of_get_ethdev_address(np, dev);
 
        ugeth->ug_info = ug_info;
        ugeth->dev = device;
index c4057de39523c07f362dccee05a8f58cde86c4c6..29190eb890c8e2f6b62bf155b5265d6362e99ff4 100644 (file)
@@ -841,7 +841,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
                           (unsigned long)phy->phy_id,
                           phy_modes(phy->interface));
 
-       ret = of_get_mac_address(node, ndev->dev_addr);
+       ret = of_get_ethdev_address(node, ndev);
        if (ret) {
                eth_hw_addr_random(ndev);
                dev_warn(dev, "using random MAC address %pM\n",
index c1aae0fca5e988d7888192d54729c5bbb889cedb..5f7ccdc834b78197c31f1f17f1c837df69fd068d 100644 (file)
@@ -1219,7 +1219,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
                goto out_phy_node;
        }
 
-       ret = of_get_mac_address(node, ndev->dev_addr);
+       ret = of_get_ethdev_address(node, ndev);
        if (ret) {
                eth_hw_addr_random(ndev);
                netdev_warn(ndev, "using random MAC address %pM\n",
index 097516af4325650f43907b0ef469bfdad5543dbb..df9a8eefa007a36c6348acc76a2a73dbb4c70409 100644 (file)
@@ -1298,7 +1298,7 @@ static int korina_probe(struct platform_device *pdev)
 
        if (mac_addr)
                eth_hw_addr_set(dev, mac_addr);
-       else if (of_get_mac_address(pdev->dev.of_node, dev->dev_addr) < 0)
+       else if (of_get_ethdev_address(pdev->dev.of_node, dev) < 0)
                eth_hw_addr_random(dev);
 
        clk = devm_clk_get_optional(&pdev->dev, "mdioclk");
index 9b7307eba97ca3d4dc807895f5edc9dee0265ea6..ecf1e11d9b911ffd565487fa6681d390b80a71d7 100644 (file)
@@ -527,7 +527,7 @@ static int xrx200_probe(struct platform_device *pdev)
                return PTR_ERR(priv->clk);
        }
 
-       err = of_get_mac_address(np, net_dev->dev_addr);
+       err = of_get_ethdev_address(np, net_dev);
        if (err)
                eth_hw_addr_random(net_dev);
 
index a9bdbf0dcfe1ed63819bd9eeb0859ded01bc61b6..3d9385a4989b7ad52e53cac65c0e934f2121e3d3 100644 (file)
@@ -266,7 +266,7 @@ static int liteeth_probe(struct platform_device *pdev)
        priv->tx_base = buf_base + priv->num_rx_slots * priv->slot_size;
        priv->tx_slot = 0;
 
-       err = of_get_mac_address(pdev->dev.of_node, netdev->dev_addr);
+       err = of_get_ethdev_address(pdev->dev.of_node, netdev);
        if (err)
                eth_hw_addr_random(netdev);
 
index 1ee9fb8cbc1b3e8ae1bd7dc36c4b3562da799c5c..761155af25d8e4f7c8e633f32ce21ba2d2e4af88 100644 (file)
@@ -5242,7 +5242,7 @@ static int mvneta_probe(struct platform_device *pdev)
                goto err_free_ports;
        }
 
-       err = of_get_mac_address(dn, dev->dev_addr);
+       err = of_get_ethdev_address(dn, dev);
        if (!err) {
                mac_from = "device tree";
        } else {
index eada23217010425611188e570e7dab22c36543ca..898b513f74e04af415ce117e730f2a7e2a79c57a 100644 (file)
@@ -1434,7 +1434,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 
        INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task);
 
-       err = of_get_mac_address(pdev->dev.of_node, dev->dev_addr);
+       err = of_get_ethdev_address(pdev->dev.of_node, dev);
        if (err) {
                /* try reading the mac address, if set by the bootloader */
                pxa168_eth_get_mac_address(dev, dev->dev_addr);
index ce131cfd93acf78003a7dcb7d7c2a3a30bf1df9c..0da18b3f1c017a0088714600f56dd4f73965bea4 100644 (file)
@@ -4720,7 +4720,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
         * 1) from device tree data
         * 2) from internal registers set by bootloader
         */
-       ret = of_get_mac_address(hw->pdev->dev.of_node, dev->dev_addr);
+       ret = of_get_ethdev_address(hw->pdev->dev.of_node, dev);
        if (ret)
                memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
                              ETH_ALEN);
index 398c23cec8151f1ef1e0978cc6b0eee04ddbf789..75d67d1b5f6b266951621285d234dd6ef4599e54 100644 (file)
@@ -2588,7 +2588,7 @@ static int __init mtk_init(struct net_device *dev)
        struct mtk_eth *eth = mac->hw;
        int ret;
 
-       ret = of_get_mac_address(mac->of_node, dev->dev_addr);
+       ret = of_get_ethdev_address(mac->of_node, dev);
        if (ret) {
                /* If the mac address is invalid, use random mac address */
                eth_hw_addr_random(dev);
index 0613528efdaeecc17efbd27068bd611e87297528..2c4e5e602be7f0bf34906b77b19b0b2b6d2dfebd 100644 (file)
@@ -195,7 +195,7 @@ static void ks8851_init_mac(struct ks8851_net *ks, struct device_node *np)
        struct net_device *dev = ks->netdev;
        int ret;
 
-       ret = of_get_mac_address(np, dev->dev_addr);
+       ret = of_get_ethdev_address(np, dev);
        if (!ret) {
                ks8851_write_mac_addr(dev);
                return;
index 11ce9fe435ba0d0162af5b382c4213cb663e86b1..43fd569aa5f1beeb6a06d865f6cdff78dcb009bc 100644 (file)
@@ -1350,7 +1350,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
        __lpc_get_mac(pldat, ndev->dev_addr);
 
        if (!is_valid_ether_addr(ndev->dev_addr)) {
-               of_get_mac_address(np, ndev->dev_addr);
+               of_get_ethdev_address(np, ndev);
        }
        if (!is_valid_ether_addr(ndev->dev_addr))
                eth_hw_addr_random(ndev);
index 8427fe1b8fd1c95759ffeb1271ba22e8628fbdae..955cce644392a93fec13ee95557b4fc10297eb64 100644 (file)
@@ -968,7 +968,7 @@ qca_spi_probe(struct spi_device *spi)
 
        spi_set_drvdata(spi, qcaspi_devs);
 
-       ret = of_get_mac_address(spi->dev.of_node, qca->net_dev->dev_addr);
+       ret = of_get_ethdev_address(spi->dev.of_node, qca->net_dev);
        if (ret) {
                eth_hw_addr_random(qca->net_dev);
                dev_info(&spi->dev, "Using random MAC address: %pM\n",
index ce3f7ce31adc1ab6c294d63a1e5482c164bf840d..27c4f43176aaaf8ac43a73c62a56c44bced730bb 100644 (file)
@@ -347,7 +347,7 @@ static int qca_uart_probe(struct serdev_device *serdev)
 
        of_property_read_u32(serdev->dev.of_node, "current-speed", &speed);
 
-       ret = of_get_mac_address(serdev->dev.of_node, qca->net_dev->dev_addr);
+       ret = of_get_ethdev_address(serdev->dev.of_node, qca->net_dev);
        if (ret) {
                eth_hw_addr_random(qca->net_dev);
                dev_info(&serdev->dev, "Using random MAC address: %pM\n",
index 9a4888543384502b1fcc90dd2cbf85dbc498fbb9..50038e76c72fedfb34d8389e6f2d94d46073bcd5 100644 (file)
@@ -132,7 +132,7 @@ static void ravb_read_mac_address(struct device_node *np,
 {
        int ret;
 
-       ret = of_get_mac_address(np, ndev->dev_addr);
+       ret = of_get_ethdev_address(np, ndev);
        if (ret) {
                u32 mahr = ravb_read(ndev, MAHR);
                u32 malr = ravb_read(ndev, MALR);
index 4639ed9438a3f44ec06b469cc77f35ca18c611d6..92653246669110b7b74b2d9ed616c8da14237497 100644 (file)
@@ -118,7 +118,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
        }
 
        /* Get MAC address if available (DT) */
-       of_get_mac_address(node, priv->dev->dev_addr);
+       of_get_ethdev_address(node, priv->dev);
 
        /* Get the TX/RX IRQ numbers */
        for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
index ae31ed93aaf02d01a7faab6894e7b22f62bf49ab..4b0fe0f58bbfeb743daf8d98ad4b25a4654a7867 100644 (file)
@@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
 
        ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
 
-       ret = of_get_mac_address(np, ndev->dev_addr);
+       ret = of_get_ethdev_address(np, ndev);
        if (ret) {
                /* if the mac address is invalid, use random mac address */
                eth_hw_addr_random(ndev);
index a4cd44a39e3d4398729089ca78fa728a105a3d45..b666e1b53c5f6100d157332d9403b47a695142e7 100644 (file)
@@ -2035,7 +2035,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
                devm_iounmap(dev, efuse);
                devm_release_mem_region(dev, res.start, size);
        } else {
-               ret = of_get_mac_address(node_interface, ndev->dev_addr);
+               ret = of_get_ethdev_address(node_interface, ndev);
                if (ret)
                        eth_random_addr(ndev->dev_addr);
        }
index 0d4394125d51333b1859e7d524b04397da8ecbf1..b95aee8607a4b2871327f79d88b5191924bec0da 100644 (file)
@@ -1157,7 +1157,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
        lp->tx_ping_pong = get_bool(ofdev, "xlnx,tx-ping-pong");
        lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 
-       rc = of_get_mac_address(ofdev->dev.of_node, ndev->dev_addr);
+       rc = of_get_ethdev_address(ofdev->dev.of_node, ndev);
        if (rc) {
                dev_warn(dev, "No MAC address found, using random\n");
                eth_hw_addr_random(ndev);