Skip to content

Commit

Permalink
net: ftmac100: add an opportunity to get ethaddr from the platform
Browse files Browse the repository at this point in the history
This driver always generated a random ethernet address. Leave it as a
fallback solution, but add a call to platform_get_ethdev_address().
Handle EPROBE_DEFER returned from platform_get_ethdev_address() to
retry when EEPROM is ready.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20220824151724.2698107-1-saproj@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Sergei Antonov authored and Jakub Kicinski committed Aug 27, 2022
1 parent 8532c60 commit f7650d8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/faraday/ftmac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,10 @@ static int ftmac100_probe(struct platform_device *pdev)
netdev->netdev_ops = &ftmac100_netdev_ops;
netdev->max_mtu = MAX_PKT_SIZE;

err = platform_get_ethdev_address(&pdev->dev, netdev);
if (err == -EPROBE_DEFER)
goto defer_get_mac;

platform_set_drvdata(pdev, netdev);

/* setup private data */
Expand Down Expand Up @@ -1138,6 +1142,7 @@ static int ftmac100_probe(struct platform_device *pdev)
release_resource(priv->res);
err_req_mem:
netif_napi_del(&priv->napi);
defer_get_mac:
free_netdev(netdev);
err_alloc_etherdev:
return err;
Expand Down

0 comments on commit f7650d8

Please sign in to comment.