netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergei Antonov <saproj@gmail.com>
To: netdev@vger.kernel.org
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	tangbin@cmss.chinamobile.com, caizhichao@yulong.com,
	Sergei Antonov <saproj@gmail.com>
Subject: [PATCH net-next] net: ftmac100: add an opportunity to get ethaddr from the platform
Date: Wed, 24 Aug 2022 18:17:24 +0300	[thread overview]
Message-ID: <20220824151724.2698107-1-saproj@gmail.com> (raw)

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>
---
 drivers/net/ethernet/faraday/ftmac100.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
index 2e6524009b19..a9af5b4c45b6 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -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 */
@@ -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;
-- 
2.34.1


             reply	other threads:[~2022-08-24 15:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 15:17 Sergei Antonov [this message]
2022-08-24 15:32 ` [PATCH net-next] net: ftmac100: add an opportunity to get ethaddr from the platform Andrew Lunn
2022-08-24 15:40   ` Sergei Antonov
2022-08-24 16:14     ` Andrew Lunn
2022-08-27  2:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220824151724.2698107-1-saproj@gmail.com \
    --to=saproj@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=caizhichao@yulong.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=tangbin@cmss.chinamobile.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).