You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
net: ethoc: Use eth_hw_addr_random()
Use eth_hw_addr_random() to set a random dev_addr and update addr_assign_type instead of open-coding it. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
e1c151a479
commit
6d6a505a1e
@@ -1031,7 +1031,6 @@ static int ethoc_probe(struct platform_device *pdev)
|
|||||||
struct ethoc *priv = NULL;
|
struct ethoc *priv = NULL;
|
||||||
int num_bd;
|
int num_bd;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
bool random_mac = false;
|
|
||||||
struct ethoc_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
struct ethoc_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||||
u32 eth_clkfreq = pdata ? pdata->eth_clkfreq : 0;
|
u32 eth_clkfreq = pdata ? pdata->eth_clkfreq : 0;
|
||||||
|
|
||||||
@@ -1169,16 +1168,11 @@ static int ethoc_probe(struct platform_device *pdev)
|
|||||||
/* Check the MAC again for validity, if it still isn't choose and
|
/* Check the MAC again for validity, if it still isn't choose and
|
||||||
* program a random one.
|
* program a random one.
|
||||||
*/
|
*/
|
||||||
if (!is_valid_ether_addr(netdev->dev_addr)) {
|
if (!is_valid_ether_addr(netdev->dev_addr))
|
||||||
eth_random_addr(netdev->dev_addr);
|
eth_hw_addr_random(netdev);
|
||||||
random_mac = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ethoc_do_set_mac_address(netdev);
|
ethoc_do_set_mac_address(netdev);
|
||||||
|
|
||||||
if (random_mac)
|
|
||||||
netdev->addr_assign_type = NET_ADDR_RANDOM;
|
|
||||||
|
|
||||||
/* Allow the platform setup code to adjust MII management bus clock. */
|
/* Allow the platform setup code to adjust MII management bus clock. */
|
||||||
if (!eth_clkfreq) {
|
if (!eth_clkfreq) {
|
||||||
struct clk *clk = devm_clk_get(&pdev->dev, NULL);
|
struct clk *clk = devm_clk_get(&pdev->dev, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user