ethernet: make use of eth_hw_addr_random() where appropriate

Number of drivers use eth_random_addr(netdev->dev_addr)
thus writing to netdev->dev_addr directly, and not setting
the address type. Switch them to eth_hw_addr_random().

  @@
  expression netdev;
  @@
  - eth_random_addr(netdev->dev_addr);
  + eth_hw_addr_random(netdev);

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2021-10-13 13:44:31 -07:00
parent 54f2d8d6ca
commit db0dcc6a8a
5 changed files with 6 additions and 6 deletions

View File

@ -1971,7 +1971,7 @@ static int ag71xx_probe(struct platform_device *pdev)
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);
eth_hw_addr_random(ndev);
}
err = of_get_phy_mode(np, &ag->phy_if_mode);

View File

@ -2473,7 +2473,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");
eth_random_addr(netdev->dev_addr);
eth_hw_addr_random(netdev);
}
gmac_write_mac_address(netdev);

View File

@ -998,7 +998,7 @@ static int hip04_mac_probe(struct platform_device *pdev)
hip04_config_port(ndev, SPEED_100, DUPLEX_FULL);
hip04_config_fifo(priv);
eth_random_addr(ndev->dev_addr);
eth_hw_addr_random(ndev);
hip04_update_mac_address(ndev);
ret = hip04_alloc_ring(ndev, d);

View File

@ -224,7 +224,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;
eth_random_addr(rmnet_dev->dev_addr);
eth_hw_addr_random(rmnet_dev);
rmnet_dev->tx_queue_len = RMNET_TX_QUEUE_LEN;
/* Raw IP mode */

View File

@ -2030,14 +2030,14 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
if (is_valid_ether_addr(efuse_mac_addr))
eth_hw_addr_set(ndev, efuse_mac_addr);
else
eth_random_addr(ndev->dev_addr);
eth_hw_addr_random(ndev);
devm_iounmap(dev, efuse);
devm_release_mem_region(dev, res.start, size);
} else {
ret = of_get_ethdev_address(node_interface, ndev);
if (ret)
eth_random_addr(ndev->dev_addr);
eth_hw_addr_random(ndev);
}
ret = of_property_read_string(node_interface, "rx-channel",