Commit 6c1f0a1f authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

net: drivers/net: Convert random_ether_addr to eth_random_addr

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: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d55207e3
...@@ -3569,9 +3569,8 @@ static int setup_nic_devices(struct octeon_device *octeon_dev) ...@@ -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++) { for (j = 0; j < octeon_dev->sriov_info.max_vfs; j++) {
u8 vfmac[ETH_ALEN]; u8 vfmac[ETH_ALEN];
random_ether_addr(&vfmac[0]); eth_random_addr(vfmac);
if (__liquidio_set_vf_mac(netdev, j, if (__liquidio_set_vf_mac(netdev, j, vfmac, false)) {
&vfmac[0], false)) {
dev_err(&octeon_dev->pci_dev->dev, dev_err(&octeon_dev->pci_dev->dev,
"Error setting VF%d MAC address\n", "Error setting VF%d MAC address\n",
j); j);
......
...@@ -2435,7 +2435,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) ...@@ -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[0], port->mac_addr[1],
port->mac_addr[2]); port->mac_addr[2]);
dev_info(dev, "using a random ethernet address\n"); 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); gmac_write_mac_address(netdev);
......
...@@ -904,7 +904,7 @@ static int hip04_mac_probe(struct platform_device *pdev) ...@@ -904,7 +904,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
hip04_config_port(ndev, SPEED_100, DUPLEX_FULL); hip04_config_port(ndev, SPEED_100, DUPLEX_FULL);
hip04_config_fifo(priv); hip04_config_fifo(priv);
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
hip04_update_mac_address(ndev); hip04_update_mac_address(ndev);
ret = hip04_alloc_ring(ndev, d); ret = hip04_alloc_ring(ndev, d);
......
...@@ -11978,7 +11978,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) ...@@ -11978,7 +11978,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
snprintf(netdev->name, IFNAMSIZ, "%.*sv%%d", snprintf(netdev->name, IFNAMSIZ, "%.*sv%%d",
IFNAMSIZ - 4, IFNAMSIZ - 4,
pf->vsi[pf->lan_vsi]->netdev->name); 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); spin_lock_bh(&vsi->mac_filter_hash_lock);
i40e_add_mac_filter(vsi, mac_addr); i40e_add_mac_filter(vsi, mac_addr);
......
...@@ -828,7 +828,7 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter) ...@@ -828,7 +828,7 @@ static int lan743x_mac_init(struct lan743x_adapter *adapter)
} }
if (!mac_address_valid) if (!mac_address_valid)
random_ether_addr(adapter->mac_address); eth_random_addr(adapter->mac_address);
lan743x_mac_set_address(adapter, adapter->mac_address); lan743x_mac_set_address(adapter, adapter->mac_address);
ether_addr_copy(netdev->dev_addr, adapter->mac_address); ether_addr_copy(netdev->dev_addr, adapter->mac_address);
return 0; return 0;
......
...@@ -212,7 +212,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs) ...@@ -212,7 +212,7 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
vp->max_tx_bw = MAX_BW; vp->max_tx_bw = MAX_BW;
vp->min_tx_bw = MIN_BW; vp->min_tx_bw = MIN_BW;
vp->spoofchk = false; vp->spoofchk = false;
random_ether_addr(vp->mac); eth_random_addr(vp->mac);
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"MAC Address %pM is configured for VF %d\n", "MAC Address %pM is configured for VF %d\n",
vp->mac, i); vp->mac, i);
......
...@@ -210,7 +210,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev) ...@@ -210,7 +210,7 @@ void rmnet_vnd_setup(struct net_device *rmnet_dev)
rmnet_dev->netdev_ops = &rmnet_vnd_ops; rmnet_dev->netdev_ops = &rmnet_vnd_ops;
rmnet_dev->mtu = RMNET_DFLT_PACKET_SIZE; rmnet_dev->mtu = RMNET_DFLT_PACKET_SIZE;
rmnet_dev->needed_headroom = RMNET_NEEDED_HEADROOM; 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; rmnet_dev->tx_queue_len = RMNET_TX_QUEUE_LEN;
/* Raw IP mode */ /* Raw IP mode */
......
...@@ -199,7 +199,7 @@ static int efx_ef10_sriov_alloc_vf_vswitching(struct efx_nic *efx) ...@@ -199,7 +199,7 @@ static int efx_ef10_sriov_alloc_vf_vswitching(struct efx_nic *efx)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < efx->vf_count; i++) { 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].efx = NULL;
nic_data->vf[i].vlan = EFX_EF10_NO_VLAN; nic_data->vf[i].vlan = EFX_EF10_NO_VLAN;
......
...@@ -2927,7 +2927,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv) ...@@ -2927,7 +2927,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
dev_info(cpsw->dev, "cpsw: Detected MACID = %pM\n", dev_info(cpsw->dev, "cpsw: Detected MACID = %pM\n",
priv_sl2->mac_addr); priv_sl2->mac_addr);
} else { } else {
random_ether_addr(priv_sl2->mac_addr); eth_random_addr(priv_sl2->mac_addr);
dev_info(cpsw->dev, "cpsw: Random MACID = %pM\n", dev_info(cpsw->dev, "cpsw: Random MACID = %pM\n",
priv_sl2->mac_addr); priv_sl2->mac_addr);
} }
......
...@@ -2052,7 +2052,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, ...@@ -2052,7 +2052,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
if (is_valid_ether_addr(efuse_mac_addr)) if (is_valid_ether_addr(efuse_mac_addr))
ether_addr_copy(ndev->dev_addr, efuse_mac_addr); ether_addr_copy(ndev->dev_addr, efuse_mac_addr);
else else
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
devm_iounmap(dev, efuse); devm_iounmap(dev, efuse);
devm_release_mem_region(dev, res.start, size); devm_release_mem_region(dev, res.start, size);
...@@ -2061,7 +2061,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, ...@@ -2061,7 +2061,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
if (mac_addr) if (mac_addr)
ether_addr_copy(ndev->dev_addr, mac_addr); ether_addr_copy(ndev->dev_addr, mac_addr);
else else
random_ether_addr(ndev->dev_addr); eth_random_addr(ndev->dev_addr);
} }
ret = of_property_read_string(node_interface, "rx-channel", ret = of_property_read_string(node_interface, "rx-channel",
......
...@@ -430,7 +430,7 @@ static int ntb_netdev_probe(struct device *client_dev) ...@@ -430,7 +430,7 @@ static int ntb_netdev_probe(struct device *client_dev)
ndev->hw_features = ndev->features; ndev->hw_features = ndev->features;
ndev->watchdog_timeo = msecs_to_jiffies(NTB_TX_TIMEOUT_MS); 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); memcpy(ndev->dev_addr, ndev->perm_addr, ndev->addr_len);
ndev->netdev_ops = &ntb_netdev_ops; ndev->netdev_ops = &ntb_netdev_ops;
......
...@@ -1720,7 +1720,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev) ...@@ -1720,7 +1720,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
"MAC address read from EEPROM"); "MAC address read from EEPROM");
} else { } else {
/* generate random MAC */ /* generate random MAC */
random_ether_addr(addr); eth_random_addr(addr);
netif_dbg(dev, ifup, dev->net, netif_dbg(dev, ifup, dev->net,
"MAC address set to random addr"); "MAC address set to random addr");
} }
......
...@@ -496,7 +496,7 @@ static void ath9k_hw_init_macaddr(struct ath_hw *ah) ...@@ -496,7 +496,7 @@ static void ath9k_hw_init_macaddr(struct ath_hw *ah)
ath_err(common, "eeprom contains invalid mac address: %pM\n", ath_err(common, "eeprom contains invalid mac address: %pM\n",
common->macaddr); common->macaddr);
random_ether_addr(common->macaddr); eth_random_addr(common->macaddr);
ath_err(common, "random mac address will be used: %pM\n", ath_err(common, "random mac address will be used: %pM\n",
common->macaddr); common->macaddr);
......
...@@ -1449,7 +1449,7 @@ static void batadv_bla_periodic_work(struct work_struct *work) ...@@ -1449,7 +1449,7 @@ static void batadv_bla_periodic_work(struct work_struct *work)
* detection frames. Set the locally administered bit to avoid * detection frames. Set the locally administered bit to avoid
* collisions with users mac addresses. * 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[0] = 0xba;
bat_priv->bla.loopdetect_addr[1] = 0xbe; bat_priv->bla.loopdetect_addr[1] = 0xbe;
bat_priv->bla.loopdetect_lasttime = jiffies; bat_priv->bla.loopdetect_lasttime = jiffies;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment