net: drivers/net: Convert random_ether_addr to eth_random_addr
authorJoe Perches <joe@perches.com>
Fri, 22 Jun 2018 17:51:00 +0000 (10:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 23 Jun 2018 01:49:14 +0000 (10:49 +0900)
random_ether_addr is a #define for eth_random_addr which is
generally preferred in kernel code by ~3:1

Convert the uses of random_ether_addr to enable removing the #define

Miscellanea:

o Convert &vfmac[0] to equivalent vfmac and avoid unnecessary line wrap

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 files changed:
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cortina/gemini.c
drivers/net/ethernet/hisilicon/hip04_eth.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/microchip/lan743x_main.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
drivers/net/ethernet/sfc/ef10_sriov.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/netcp_core.c
drivers/net/ntb_netdev.c
drivers/net/usb/lan78xx.c
drivers/net/wireless/ath/ath9k/hw.c
net/batman-adv/bridge_loop_avoidance.c

index 8a815bb5717732331293e9fba5b00d3ca23aaf88..7cb4e753829b43afa5d44aaf7196139430202ae6 100644 (file)
@@ -3569,9 +3569,8 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
                for (j = 0; j < octeon_dev->sriov_info.max_vfs; j++) {
                        u8 vfmac[ETH_ALEN];
 
-                       random_ether_addr(&vfmac[0]);
-                       if (__liquidio_set_vf_mac(netdev, j,
-                                                 &vfmac[0], false)) {
+                       eth_random_addr(vfmac);
+                       if (__liquidio_set_vf_mac(netdev, j, vfmac, false)) {
                                dev_err(&octeon_dev->pci_dev->dev,
                                        "Error setting VF%d MAC address\n",
                                        j);
index 6d7404f66f84af7322c6b58def8cbff94958ca12..ce1f04fdbf7066ff4843973d14824d32bebd3db5 100644 (file)
@@ -2435,7 +2435,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
                        port->mac_addr[0], port->mac_addr[1],
                        port->mac_addr[2]);
                dev_info(dev, "using a random ethernet address\n");
-               random_ether_addr(netdev->dev_addr);
+               eth_random_addr(netdev->dev_addr);
        }
        gmac_write_mac_address(netdev);
 
index 340e28211135a266b5a955ef432f6e8786d4f23b..14374a856d3091a9489e92669c7d93e3e797a115 100644 (file)
@@ -904,7 +904,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
                hip04_config_port(ndev, SPEED_100, DUPLEX_FULL);
 
        hip04_config_fifo(priv);
-       random_ether_addr(ndev->dev_addr);
+       eth_random_addr(ndev->dev_addr);
        hip04_update_mac_address(ndev);
 
        ret = hip04_alloc_ring(ndev, d);
index c944bd10b03d29c5711903714456ac9ca975e735..95e9dfbe98395a6e2eb18c3a72fbd22ecfe40a2c 100644 (file)
@@ -11978,7 +11978,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
                snprintf(netdev->name, IFNAMSIZ, "%.*sv%%d",
                         IFNAMSIZ - 4,
                         pf->vsi[pf->lan_vsi]->netdev->name);
-               random_ether_addr(mac_addr);
+               eth_random_addr(mac_addr);
 
                spin_lock_bh(&vsi->mac_filter_hash_lock);
                i40e_add_mac_filter(vsi, mac_addr);
index dd947e4dd3ce8c2f4cdca56d9f75d33aecd9f41c..e1747a4900666ac0a27db42cbeb87b4d0ac7e06e 100644 (file)
@@ -828,7 +828,7 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter)
        }
 
        if (!mac_address_valid)
-               random_ether_addr(adapter->mac_address);
+               eth_random_addr(adapter->mac_address);
        lan743x_mac_set_address(adapter, adapter->mac_address);
        ether_addr_copy(netdev->dev_addr, adapter->mac_address);
        return 0;
index 0c744b9c6e0adf96f91d6aba6c7cda34b208c7fe..77e386ebff09c110ecd77e6c289e3354fe52cd22 100644 (file)
@@ -212,7 +212,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
                        vp->max_tx_bw = MAX_BW;
                        vp->min_tx_bw = MIN_BW;
                        vp->spoofchk = false;
-                       random_ether_addr(vp->mac);
+                       eth_random_addr(vp->mac);
                        dev_info(&adapter->pdev->dev,
                                 "MAC Address %pM is configured for VF %d\n",
                                 vp->mac, i);
index b9a7548ec6a0a7ed2cc7939b4adac70188b37cd8..0afc3d335d562d24466b9192aea291b910ebcdfe 100644 (file)
@@ -210,7 +210,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev)
        rmnet_dev->netdev_ops = &rmnet_vnd_ops;
        rmnet_dev->mtu = RMNET_DFLT_PACKET_SIZE;
        rmnet_dev->needed_headroom = RMNET_NEEDED_HEADROOM;
-       random_ether_addr(rmnet_dev->dev_addr);
+       eth_random_addr(rmnet_dev->dev_addr);
        rmnet_dev->tx_queue_len = RMNET_TX_QUEUE_LEN;
 
        /* Raw IP mode */
index 019cef1d3cf72ce2d34b3a36283cabf9227c9879..8820be83ce85d90bf3be0c156d88d8d11517753a 100644 (file)
@@ -199,7 +199,7 @@ static int efx_ef10_sriov_alloc_vf_vswitching(struct efx_nic *efx)
                return -ENOMEM;
 
        for (i = 0; i < efx->vf_count; i++) {
-               random_ether_addr(nic_data->vf[i].mac);
+               eth_random_addr(nic_data->vf[i].mac);
                nic_data->vf[i].efx = NULL;
                nic_data->vf[i].vlan = EFX_EF10_NO_VLAN;
 
index 358edab9e72eeee18b9c17d74e66f2de92d5cc87..093998124149f24c918406dd082fd5075101f6fb 100644 (file)
@@ -2927,7 +2927,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
                dev_info(cpsw->dev, "cpsw: Detected MACID = %pM\n",
                         priv_sl2->mac_addr);
        } else {
-               random_ether_addr(priv_sl2->mac_addr);
+               eth_random_addr(priv_sl2->mac_addr);
                dev_info(cpsw->dev, "cpsw: Random MACID = %pM\n",
                         priv_sl2->mac_addr);
        }
index e40aa3e31af2345489a4dbc896593c7dc0f574cd..6ebf110cd5947ed8950a454aadf9f8d447a7ad8a 100644 (file)
@@ -2052,7 +2052,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
                if (is_valid_ether_addr(efuse_mac_addr))
                        ether_addr_copy(ndev->dev_addr, efuse_mac_addr);
                else
-                       random_ether_addr(ndev->dev_addr);
+                       eth_random_addr(ndev->dev_addr);
 
                devm_iounmap(dev, efuse);
                devm_release_mem_region(dev, res.start, size);
@@ -2061,7 +2061,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
                if (mac_addr)
                        ether_addr_copy(ndev->dev_addr, mac_addr);
                else
-                       random_ether_addr(ndev->dev_addr);
+                       eth_random_addr(ndev->dev_addr);
        }
 
        ret = of_property_read_string(node_interface, "rx-channel",
index 9f6f7ccd44f775686dd4807d52b409be407026b9..b12023bc2cab5feb15ceedbe2fc357dfcf37627e 100644 (file)
@@ -430,7 +430,7 @@ static int ntb_netdev_probe(struct device *client_dev)
        ndev->hw_features = ndev->features;
        ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS);
 
-       random_ether_addr(ndev->perm_addr);
+       eth_random_addr(ndev->perm_addr);
        memcpy(ndev->dev_addr, ndev->perm_addr, ndev->addr_len);
 
        ndev->netdev_ops = &ntb_netdev_ops;
index 8dff87ec6d99c5dca122dcdb5d3697157564cfa2..a89570f34937f7710a7252f3ce0847e93d5d76e2 100644 (file)
@@ -1720,7 +1720,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
                                  "MAC address read from EEPROM");
                } else {
                        /* generate random MAC */
-                       random_ether_addr(addr);
+                       eth_random_addr(addr);
                        netif_dbg(dev, ifup, dev->net,
                                  "MAC address set to random addr");
                }
index e60bea4604e4104dbcc837ddf23ecd890a299e2e..1665066f4e242a5a0b2441c7d74d591234906d02 100644 (file)
@@ -496,7 +496,7 @@ static void ath9k_hw_init_macaddr(struct ath_hw *ah)
        ath_err(common, "eeprom contains invalid mac address: %pM\n",
                common->macaddr);
 
-       random_ether_addr(common->macaddr);
+       eth_random_addr(common->macaddr);
        ath_err(common, "random mac address will be used: %pM\n",
                common->macaddr);
 
index a2de5a44bd41bf5c3d521d29b72e0b225a3ace05..ff9659af6b9177cdb23523d79a4bc70665b1cc4d 100644 (file)
@@ -1449,7 +1449,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
                 * detection frames. Set the locally administered bit to avoid
                 * collisions with users mac addresses.
                 */
-               random_ether_addr(bat_priv->bla.loopdetect_addr);
+               eth_random_addr(bat_priv->bla.loopdetect_addr);
                bat_priv->bla.loopdetect_addr[0] = 0xba;
                bat_priv->bla.loopdetect_addr[1] = 0xbe;
                bat_priv->bla.loopdetect_lasttime = jiffies;